home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / video / fly8111-.000 / fly8111- / fly8 / docs / tmac.gm < prev    next >
Text File  |  1979-12-31  |  58KB  |  2,532 lines

  1. .\"    Version: modified by rpj@ise.canberra.edu.au
  2. .ds RE 1.04rpj
  3. .ig
  4. Copyright (C) 1991 Free Software Foundation, Inc.
  5. mgm is written by J÷rgen HΣgg (jh@efd.lth.se)
  6.  
  7. mgm is free software; you can redistribute it and/or modify it under
  8. the terms of the GNU General Public License as published by the Free
  9. Software Foundation; either version 1, or (at your option) any later
  10. version.
  11.  
  12. mgm is distributed in the hope that it will be useful, but WITHOUT ANY
  13. WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15. for more details.
  16.  
  17. You should have received a copy of the GNU General Public License along
  18. with groff; see the file LICENSE.  If not, write to the Free Software
  19. Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  
  21.  
  22. Almost complete. The letter format is not included.
  23. Maybe as a separate package.
  24. Should be better as time goes.
  25.  
  26.     -- Changes made by rpj@ise.canberra.edu.au  Dec-Jan 1993:
  27.  
  28.     Fix bug in DL list macro causing problem resuming proper indentation
  29.     when exited.
  30.  
  31.     Added test for N register in case set on commandline.
  32.     All of N=0,1,2,3,4,5 now implemented.
  33.     Not sure about N=3 or 5, whether REFERENCES should be output
  34.     at the end of each section as they are now. If not then how do I
  35.     page number them in the TOC. Have not tested labelled displays
  36.     for N=5 which were already done (partially?) in the original.
  37.  
  38.     Fixed bug in .RP missing ()s in    .if conditional emmitting .SK.
  39.  
  40.     Added internal @ntc register for nroff/troff conversion of certain
  41.     standard spacings ( spacings are divided by @ntc which is
  42.     set to 1 for nroff and 2 for troff ie. 1v becomes 0.5v for troff).
  43.     This helps to make nroff output a reasonable facsimile of troff.
  44.     ie. the following types of spacings are affected:
  45.         paragraphs
  46.         lists
  47.         headers
  48.         table of contents
  49.         reference lists
  50.     macros affected:
  51.         par@doit
  52.         H
  53.         LB
  54.         LI
  55.         LE
  56.         TC ( defined toc*spacing as 1v/\n[@ntc]u )
  57.         RF
  58.  
  59.     Fixed bug in table of contents toc@save macro to guarrantee a
  60.     space between headernumber and header text in TOC.
  61.  
  62.     Set pa@ind-flag in .P rather than par@doit to indent (para type 2)
  63.     second para after header rather than the third.
  64.  
  65.     NEW feature: HEADING "KEEP WITH NEXT"
  66.     Minor modifications to the .H macro involving hd*need allows
  67.     .H to better detect when a heading should be forced onto the next
  68.     page. If there isn't enough space for all of:
  69.  
  70.         Heading pre-space
  71.         Heading text (at correct point size - ie. from HP)
  72.         Heading post-space if required
  73.         First line of following paragraph
  74.  
  75.     then the heading will be output at the top of the next page.
  76.  
  77.     The call to the user macro HY has been moved later in .H after
  78.     the heading point size has been set from HP. I'm not sure if this
  79.     is correct but the book I have lists it as "User supplied exit
  80.     macro in middle of printing heading".
  81.  
  82.     NEW feature: PROPORTIONAL HEADING PRE-SPACE
  83.     It is very convenient if Heading pre-space is relative to
  84.     heading point size. This can't be done with the current
  85.     definition of registers Hps1 and Hps2 being arbitrarily
  86.     scaleable to whatever point size is in force at the time they're
  87.     set, nor can they be used (from within .H) to take account of point
  88.     sizes set in string HP.
  89.  
  90.         To do this I have added two new registers Hpps1 and
  91.     Hpps2 (Heading proportional pre-space). To allow fractional values
  92.     and/or carry the scaling letter through until it's actual usage,
  93.     Hpps1 and Hpps2 were made string registers. It is intended
  94.     that the "value" will either be unscaled or use v, m or n, but other
  95.     "absolute" scales can be used. These *strings* should only be
  96.     used as an argument to .SP.
  97.  
  98.         A new macro, .HPPS can be used to set Hpps1, Hpps2, Hps1,
  99.     and Hps2 all at once. This is the preferred way of setting the
  100.     new registers since it hides the fact that they're strings
  101.     (whereas Hps1/Hps2 are numbers).
  102.  
  103.         .H has been modified to call .S rather than set .ps
  104.     directly so that .vs is set appropriately for the new registers
  105.     to work. As a result the hd*save-ps register isn't needed.
  106.  
  107.     -- END (rpj@ise.canberra.edu.au)
  108.  
  109. Please send bugreports with examples to jh@efd.lth.se.
  110.  
  111. Naming convention stolen from mgs.
  112. Local names    module*name
  113. Extern names    module@name
  114. Env.var        environ:name
  115. Index        array!index
  116. ..
  117. .warn
  118. .\" ####### init ######
  119. .\"    Contents level [0:7], contents saved if heading level <= Cl
  120. .nr Cl 2
  121. .\"    Eject page between LIST OF XXXX if Cp == 0
  122. .nr Cp 0
  123. .\"    Debugflag
  124. .if !r D .nr D 0
  125. .\"    Eject after floating display is output [0:1]
  126. .nr De 0
  127. .\"    Floating keep output [0;5]
  128. .nr Df 5
  129. .\"    space before and after display if == 1 [0:1]
  130. .nr Ds 1
  131. .\"    Eject page
  132. .nr Ej 0
  133. .\"    Eqation lable adjust 0=left, 1=right
  134. .nr Eq 0
  135. .\"    Em dash string
  136. .ds EM \-
  137. .\"    Footnote spacing
  138. .nr Fs 1
  139. .\"    H1-H7    heading counters
  140. .nr H1 0 1
  141. .nr H2 0 1
  142. .nr H3 0 1
  143. .nr H4 0 1
  144. .nr H5 0 1
  145. .nr H6 0 1
  146. .nr H7 0 1
  147. .\"    Heading break level [0:7]
  148. .nr Hb 2
  149. .\"    heading centering level, [0:7]
  150. .nr Hc 0
  151. .\"    header format
  152. .ds HF 2 2 2 2 2 2 2
  153. .\"    heading temp. indent [0:2]
  154. .\"    0 -> 0 indent, left margin
  155. .\"    1 -> indent to right , like .P 1
  156. .\"    2 -> indent to line up with text part of preceding heading
  157. .nr Hi 1
  158. .\"    header pointsize
  159. .ds HP 0 0 0 0 0 0 0
  160. .\"    heading space level [0:7]
  161. .nr Hs 2
  162. .\"    heading numbering type
  163. .\"    0 -> multiple (1.1.1 ...)
  164. .\"    1 -> single
  165. .nr Ht 0
  166. .\"    Unnumbered heading level
  167. .nr Hu 2
  168. .\"    hyphenation in body
  169. .\"    0 -> no hyphenation
  170. .\"    1 -> hyphenation 14 on
  171. .nr Hy 1
  172. .\"    text for toc, selfexplanatory. Look in the new variable section
  173. .ds Lf LIST OF FIGURES
  174. .nr Lf 1
  175. .ds Lt LIST OF TABLES
  176. .nr Lt 1
  177. .ds Lx LIST OF EXHIBITS
  178. .nr Lx 1
  179. .ds Le LIST OF EQUATIONS
  180. .nr Le 0
  181. .\"    List indent, used by .AL
  182. .nr Li 6
  183. .\"    List space, if listlevel > Ls then no spacing will occur around lists.
  184. .nr Ls 99
  185. .\"    Numbering style [0:5]
  186. .if !r N .nr N 0
  187. .\"    numbered paragraphs
  188. .\"    0 == not numbered
  189. .\"    1 == numbered in first level headings.
  190. .nr Np 0
  191. .\"    Format of figure,table,exhibit,equation titles.
  192. .\"    0= ". ", 1=" - "
  193. .nr Of 0
  194. .\"    paragraph indent
  195. .nr Pi 5
  196. .\"    paragraph spacing
  197. .nr Ps 1
  198. .\"    paragraph type
  199. .\"    0 == left-justified
  200. .\"    1 == indented .P
  201. .\"    2 == indented .P except after .H, .DE or .LE.
  202. .nr Pt 0
  203. .\"    Reference title
  204. .ds Rp REFERENCES
  205. .\"    Display indent
  206. .nr Si 5
  207. .\"
  208. .ds Tm \(tm
  209. .\"
  210. .\"---------------------------------------------
  211. .\"    Internal global variables
  212. .\"
  213. .\" These two are for cover macro .MT
  214. .\" Change @langage in the national file.
  215. .ds @cur-lib /usr/local/lib/groff/tmac
  216. .\" .ds @language
  217. .\"    Current pointsize and vertical space, always in points.
  218. .nr @ps 10
  219. .nr @vs 12
  220. .\"    Page length
  221. .ie r L .nr @pl \n[L]
  222. .el .nr @pl 11i
  223. .\"    page width
  224. .ie r W .nr @ll \n[W]
  225. .el .nr @ll 6i
  226. .\"    page offset
  227. .ie r O .nr @po \n[O]
  228. .el .nr @po 1i
  229. .\"
  230. .\" nroff/troff conversion value for size of blank line (rpj)
  231. .ie t .nr @ntc 2
  232. .el .nr @ntc 1
  233. .\"
  234. .\" cheating...
  235. .\".pl 100i
  236. .pl \n[@pl]u
  237. .ll \n[@ll]u
  238. .po \n[@po]u
  239. .nr @cur-ll \n[@ll]
  240. .\"---------------------------------------------
  241. .\"    New variables
  242. .\"
  243. .\" Appendix name
  244. .ds App APPENDIX
  245. .\" print appendixheader, 0 == don't
  246. .nr Aph 1
  247. .\"
  248. .\" header prespace level. If level <= Hps, then two lines will be printed
  249. .\" before the header instead of one.
  250. .nr Hps 1
  251. .\"
  252. .\" These variables controls the number of lines preceding .H.
  253. .\" Hps1 is the number of lines when level > Hps
  254. .nr Hps1 0.5v
  255. .if n .nr Hps1 1v
  256. .\"
  257. .\" Hps2 is the number of lines when level <= Hps
  258. .nr Hps2 1v
  259. .if n .nr Hps2 2v
  260. .\"
  261. .\" These *string* variables control the proportional heading pre-space.
  262. .\" If no scaling character is used, or v, m or n is used, then the value
  263. .\" is relative to the heading point size when output. This is how it's
  264. .\" meant to be used, but other scalings can be used for absolute sizes.
  265. .\" They default to 0 for compatibility.
  266. .\"     The macro
  267. .\"        .HPPS [Hpps1] [Hpps2] [Hps1] [Hps2]
  268. .\"    has been included to provide a preferred method of setting these
  269. .\"    values.
  270. .\" Hpps1 is the vertical pre-space when level > Hps
  271. .if !d Hpps1 .ds Hpps1 0v
  272. .\"
  273. .\" Hpps2 is the vertical pre-space when level <= Hps
  274. .if !d Hpps2 .ds Hpps2 0v
  275. .\"
  276. .\" flag for mkindex
  277. .if !r Idxf .nr Idxf 0
  278. .\"    Change these in the national configuration file
  279. .ds Lifg Figure
  280. .ds Litb TABLE
  281. .ds Liex Exhibit
  282. .ds Liec Equation
  283. .ds Licon CONTENTS
  284. .\"
  285. .\" Lsp controls the height of an empty line. Normally 0.5v
  286. .nr Lsp 0.5v
  287. .if n .nr Lsp 1v
  288. .ds MO1 January
  289. .ds MO2 February
  290. .ds MO3 March
  291. .ds MO4 April
  292. .ds MO5 May
  293. .ds MO6 June
  294. .ds MO7 July
  295. .ds MO8 August
  296. .ds MO9 September
  297. .ds MO10 October
  298. .ds MO11 November
  299. .ds MO12 December
  300. .\" for GETR
  301. .ds Qrf See chapter \\*[Qrfh], page \\*[Qrfp].
  302. .\"    test for mgm macro. This can be used if the text must test
  303. .\"    what macros is used.
  304. .nr .mgm 1
  305. .\"
  306. .\"---------------------------------------------
  307. .\" set local variables.
  308. .ie d @language .mso mm/\\*[@language]_locale
  309. .el .mso mm/locale
  310. .\"---------------------------------------------
  311. .if \n[D] .tm Groff mm, version \*[RE].
  312. .\" ####### module init ######
  313. .\"    reset all things
  314. .de init@reset
  315. .ie \\n[misc@adjust] 'ad
  316. .el 'na
  317. .ie \\n[Hy] 'hy 14
  318. .el 'nh
  319. 'in 0
  320. 'ti 0
  321. 'ps \\n[@ps]
  322. 'vs \\n[@vs]
  323. ..
  324. .de @error
  325. .tm ******************
  326. .tm ERROR:(\\n[.F]) input line \\n[.c]:\\$*
  327. .if \\n[D] .backtrace
  328. .tm ******************
  329. .ab
  330. ..
  331. .\" ####### module debug #################################
  332. .de debug
  333. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s],\\n[.ps] \
  334. in=\\n[.i] fi=\\n[.u] .d=\\n[.d] nl=\\n[nl] pg=\\n[%]
  335. ..
  336. .de debug-all
  337. .nr debug*n 1n
  338. .nr debug*m 1m
  339. .tm \\$1:\\n[.F]:\\n[c.] ll=\\n[.l] vs=\\n[.v] ps=\\n[.s] in=\\n[.i]\
  340.  ad=\\n[.j] fi=\\n[.u] pl=\\n[.p] page=\\n[%] .o=\\n[.o]
  341. .tm _______ .d=\\n[.d] .f=\\n[.f] .h=\\n[.h] .k=\\n[.k] .n=\\n[.n]\
  342.  .p=\\n[.p] .t=\\n[.t] .z=\\n[.z] nl=\\n[nl] dn=\\n[dn] n=\\n[debug*n]
  343. ..
  344. .\" ####### module par #################################
  345. .nr par@ind-flag 1            \" indent on following P if Pt=2
  346. .nr hd*last-pos -1
  347. .nr hd*last-hpos -1
  348. .nr par*number 0 1
  349. .af par*number 01
  350. .nr par*num-count 0 1
  351. .af par*num-count 01
  352. .\"    reset numbered paragraphs, arg1 = headerlevel
  353. .de par@reset-num
  354. .if \\$1<3 .nr par*num-count 0
  355. .if (\\$1=1)&(\\n[Np]=1) .nr par*number 0
  356. ..
  357. .\"------------
  358. .\" paragraph
  359. .de P
  360. .\"    skip P if previous heading
  361. .ie !((\\n[nl]=\\n[hd*last-pos]):(\\n[nl]=(\\n[hd*last-pos]-.5v))) \{\
  362. .    if \\n[D]>2 .tm Paragraph 
  363. .    par@doit \\$*
  364. .\}
  365. .el .if !(\\n[hd*last-hpos]=\\n[.k]) \{\
  366. .    if \\n[D]>2 .tm Paragraph 
  367. .    par@doit \\$*
  368. .\}
  369. .nr par@ind-flag 1
  370. ..
  371. .de par@doit
  372. .SP \\n[Ps]/\\n[@ntc]u
  373. .ie  \\n[.$] \{\
  374. .    if \\$1=1 .ti +\\n[Pi]n
  375. .\}
  376. .el \{\
  377. .    if \\n[Pt]=1 .ti +\\n[Pi]n
  378. .    if (\\n[Pt]=2)&\\n[par@ind-flag] .ti +\\n[Pi]n
  379. .\}
  380. .if \\n[Np] \{\
  381. \\n[H1].\\n+[par*number]\ \ \c
  382. .\" $$$ 'br
  383. .\}
  384. ..
  385. .\" ####### module line #######################################
  386. .de SP
  387. .br
  388. .if !r line*lp\\n[.z] .nr line*lp\\n[.z] 0
  389. .if !r line*ac\\n[.z] .nr line*ac\\n[.z] 0
  390. .ie \\n[.$] .nr line*temp (v;\\$1)
  391. .el .nr line*temp 1v
  392. .\"
  393. .ie \\n[line*lp\\n[.z]]=\\n[.d] \{\
  394. .    \" go here if no output since the last .SP
  395. .    nr line*output \\n[line*temp]-\\n[line*ac\\n[.z]]
  396. .    if \\n[line*output]<0 .nr line*output 0
  397. .    nr line*ac\\n[.z] +\\n[line*output]
  398. .\}
  399. .el \{\
  400. .    nr line*ac\\n[.z] \\n[line*temp]
  401. .    nr line*output \\n[line*temp]
  402. .    \" no extra space in the beginning of a page
  403. .    if (\\n[.d]<0):(\\n[pg*head-mark]=\\n[.d]) .nr line*output 0
  404. .\}
  405. .if \\n[line*output] .sp \\n[line*output]u
  406. .nr line*lp\\n[.z] \\n[.d]
  407. ..
  408. .\" ######## module misc ###############
  409. .nr misc@adjust 14
  410. .de SA
  411. .if \\n[.$] \{\
  412. .    if \\$1-1 .@error "SA: bad arg: \\$1"
  413. .    nr misc@adjust 0\\$1
  414. .\}
  415. .ie \\n[misc@adjust] 'ad
  416. .el 'na
  417. ..
  418. .\"-------------
  419. .\" switch environment, keep all important settings.
  420. .de misc@ev-keep
  421. .nr misc*ll \\n[.l]
  422. .ev \\$1
  423. .ll \\n[misc*ll]u
  424. ..
  425. .\"-------------
  426. .\" .misc@push stackname value
  427. .de misc@push
  428. .ie d misc*st-\\$1 .ds misc*st-\\$1 \\$2 \\*[misc*st-\\$1]
  429. .el .ds misc*st-\\$1 \\$2
  430. ..
  431. .\"-------------
  432. .\" .misc@pop stackname
  433. .\" value returned in the string misc*pop
  434. .de misc@pop
  435. .misc@pop-set misc*st-\\$1 \\*[misc*st-\\$1]
  436. ..
  437. .\"-------------
  438. .de misc@pop-set
  439. .ds misc*st-name \\$1
  440. .shift
  441. .if \\n[.$]<1 .@error "stack \\*[misc*st-name] empty"
  442. .ds misc*pop \\$1
  443. .shift
  444. .ds \\*[misc*st-name] \\$*
  445. ..
  446. .\"-------------
  447. .\" .misc@pop-nr stackname varname
  448. .de misc@pop-nr
  449. .misc@pop \\$1
  450. .nr \\$2 \\*[misc*pop]
  451. ..
  452. .\"-------------
  453. .\" .misc@pop-ds stackname varname
  454. .de misc@pop-ds
  455. .misc@pop \\$1
  456. .ds \\$2 \\*[misc*pop]
  457. ..
  458. .\"-----------
  459. .\" reset tabs
  460. .de TAB
  461. .ta T 5n
  462. ..
  463. .\"-------------
  464. .\" .PGFORM linelength [ pagelength [ pageoffset ] ]
  465. .de PGFORM
  466. .if !''\\$1' .nr @ll \\$1
  467. .if !''\\$2' .nr @pl \\$2
  468. .if !''\\$3' .nr @po \\$3
  469. .ll \\n[@ll]u
  470. .po \\n[@po]u
  471. .pl \\n[@pl]u
  472. .nr @cur-ll \\n[@ll]
  473. .in 0
  474. .pg@move-trap
  475. ..
  476. .\"-------------
  477. .\" .MOVE y [[x] linelength]
  478. .\" move to line y, indent to x
  479. .de MOVE
  480. .if !\\n[.$] .@error "MOVE y [x]: no arguments"
  481. .if \\n[nl]<0 \c
  482. .sp |(v;\\$1)
  483. .ie \\n[.$]>2 .nr pg*i (v;\\$3)
  484. .el \{\
  485. .    ie \\n[.$]>1 .nr pg*i (v;\\n[@ll]u-\\$2)
  486. .    el .nr pg*i (v;\\n[@ll]u)
  487. .\}
  488. .if !''\\$2' \{\
  489. .    po \\$2
  490. .    ll \\n[pg*i]u+\\n[@po]u
  491. .\}
  492. ..
  493. .\"-------------
  494. .de SM
  495. .if !\\n[.$] .@error "SM: no arguments"
  496. .if \\n[.$]=1 \s-1\\$1\s0
  497. .if \\n[.$]=2 \s-1\\$1\s0\\$2
  498. .if \\n[.$]=3 \\$1\s-1\\$2\s0\\$3
  499. ..
  500. .\"-------------
  501. .nr misc*S-ps \n[@ps]
  502. .nr misc*S-vs \n[@vs]
  503. .nr misc*S-ps1 \n[@ps]
  504. .nr misc*S-vs1 \n[@vs]
  505. .ds misc*a
  506. .ds misc*b
  507. .de S
  508. .ie !\\n[.$] \{\
  509. .    ds misc*a P
  510. .    ds misc*b P
  511. .\}
  512. .el \{\
  513. .    ie \\n[.$]=1 .ds misc*b D
  514. .    el \{\
  515. .        ie \w'\\$2'=0 .ds misc*b C
  516. .        el .ds misc*b \\$2
  517. .    \}
  518. .    ie \w'\\$1'=0 .ds misc*a C
  519. .    el .ds misc*a \\$1
  520. .\}
  521. .\" set point size
  522. .if !'\\*[misc*a]'C' \{\
  523. .    ie '\\*[misc*a]'P' .nr @ps \\n[misc*S-ps]
  524. .    el \{\
  525. .        ie '\\*[misc*a]'D' .nr @ps 10
  526. .        el .nr @ps \\*[misc*a]
  527. .    \}
  528. .\}
  529. .\" set vertical spacing
  530. .if !'\\*[misc*b]'C' \{\
  531. .    ie '\\*[misc*b]'P' .nr @vs \\n[misc*S-vs]
  532. .    el \{\
  533. .        ie '\\*[misc*b]'D' .nr @vs \\n[@ps]+2
  534. .        el .nr @vs \\*[misc*b]
  535. .    \}
  536. .\}
  537. 'ps \\n[@ps]
  538. 'vs \\n[@vs]
  539. .if \\n[D]>1 .tm point-size \\n[@ps] (\\n[.s]), vertical spacing \\n[@vs] (\\n[.v])
  540. .nr misc*S-ps \\n[misc*S-ps1]
  541. .nr misc*S-vs \\n[misc*S-vs1]
  542. .nr misc*S-ps1 \\n[@ps]
  543. .nr misc*S-vs1 \\n[@vs]
  544. ..
  545. .\"------------
  546. .de HC
  547. .ev 0
  548. .hc \\$1
  549. .ev
  550. .ev 1
  551. .hc \\$1
  552. .ev
  553. .ev 2
  554. .hc \\$1
  555. .ev
  556. ..
  557. .\"------------
  558. .de RD
  559. .di misc*rd
  560. 'fl
  561. .rd \\$1
  562. .br
  563. .di
  564. .ie !''\\$3' \{\
  565. .    di misc*rd2
  566. .    ds \\$3 "\\*[misc*rd]
  567. .    br
  568. .    di
  569. .\}
  570. .if !''\\$2' .rn misc*rd \\$2
  571. .rm misc*rd misc*rd2
  572. ..
  573. .\"------------
  574. .de VERBON
  575. .br
  576. .misc@ev-keep misc*verb-ev
  577. .nf
  578. .ft CR
  579. .ss 12
  580. .ta T 8u*\w'n'u
  581. ..
  582. .de VERBOFF
  583. .ev
  584. ..
  585. .\" ######## module acc #################
  586. .\"-----------
  587. .\" accents. These are copied from mgs, written by James Clark.
  588. .de acc@over-def
  589. .ds \\$1 \Z'\v'(u;\w'x'*0+\En[rst]-\En[.cht])'\
  590. \h'(u;-\En[skw]+(-\En[.w]-\w'\\$2'/2)+\En[.csk])'\\$2'
  591. ..
  592. .de acc@under-def
  593. .ds \\$1 \Z'\v'\En[.cdp]u'\h'(u;-\En[.w]-\w'\\$2'/2)'\\$2'
  594. ..
  595. .acc@over-def ` \`
  596. .acc@over-def ' \'
  597. .acc@over-def ^ ^
  598. .acc@over-def ~ ~
  599. .acc@over-def : \(ad
  600. .acc@over-def ; \(ad
  601. .acc@under-def , \(ac
  602. .\" ######## module uni #################
  603. .\" unimplemented macros
  604. .de OK
  605. .tm "OK: not implemented"
  606. ..
  607. .de PM
  608. .tm "PM: not implemented"
  609. ..
  610. .\" ######## module hd #################
  611. .\" support for usermacro
  612. .nr hd*htype 0
  613. .ds hd*mark
  614. .ds hd*suf-space
  615. .nr hd*need 0
  616. .aln ;0 hd*htype
  617. .als }0 hd*mark
  618. .als }2 hd*suf-space
  619. .aln ;3 hd*need
  620. .\"-------------
  621. .\" .hd@split varable index name val1 val2 ...
  622. .de hd@split
  623. .if \\$2>(\\n[.$]-3) .@error "\\$3 must have at least \\$2 values (\\*[\\$3]).
  624. .nr hd*sp-tmp \\$2+3
  625. .ds \\$1 \\$[\\n[hd*sp-tmp]]
  626. ..
  627. .de HU
  628. .H 0 "\\$1"
  629. ..
  630. .de HPPS
  631. .if \\n[.$]>=1 .ds Hpps1 \\$1
  632. .if \\n[.$]>=2 .ds Hpps2 \\$2
  633. .if \\n[.$]>=3 .nr Hps1 \\$3
  634. .if \\n[.$]>=4 .nr Hps2 \\$4
  635. ..
  636. .\"-------------
  637. .de H
  638. .nr hd*cur-bline \\n[nl]
  639. .br
  640. .ds@print-float 2\"    $$$ could be wrong...
  641. .\" terminate all lists
  642. .LC 0
  643. .init@reset
  644. .nr hd*level 0\\$1
  645. .nr hd*arg1 0\\$1
  646. .if !\\n[hd*level] .nr hd*level \\n[Hu]
  647. .\"    Check if it's time for new page.
  648. .if \\n[Ej]&(\\n[Ej]>=\\n[hd*level]) \{\
  649. .    ie \\n[pg*ref-reset] \{\
  650. .        if d ref*div \{\
  651. .\"            Do references for this section
  652. .            ie \\n[hd*cur-bline]>=0 .RP 0 0\" Break before and after
  653. .            el .RP 0 2\" Break after
  654. .        \}
  655. .    \}
  656. .    el .if \\n[hd*cur-bline]>=0 .pg@next-page
  657. .    if \\n[pg*sect-reset] \{\
  658. .\"        Reset footnotes and page number
  659. .        FD "" 1
  660. .        nr P 1
  661. .    \}
  662. .\}
  663. .\"    clear lower counters
  664. .nr hd*i 1 1
  665. .while \\n+[hd*i]<8 .if \\n[hd*level]<\\n[hd*i] .nr H\\n[hd*i] 0 1
  666. .\"
  667. .\" increment current counter
  668. .nr H\\n[hd*level] +1
  669. .\" Pre-space only if not at top of page
  670. .if \\n[hd*cur-bline]>\\n[pg*top-nl] \{\
  671. .    ie \\n[hd*level]<=\\n[Hps] .SP \\n[Hps2]u\"         pre-space
  672. .    el .SP \\n[Hps1]u
  673. .\}
  674. .\"
  675. .\" hd*mark is the text written to the left of the header.
  676. .ds hd*mark \\n[H1].
  677. .if \\n[hd*level]>1 .as hd*mark \\n[H2]
  678. .nr hd*i 2 1
  679. .while \\n+[hd*i]<8 .if \\n[hd*level]>(\\n[hd*i]-1) .as hd*mark .\\n[H\\n[hd*i]]
  680. .if \\n[Ht] .ds hd*mark \\n[H\\n[hd*level]].
  681. .\"
  682. .\" toc-mark is sent to the table of contents
  683. .ds hd*toc-mark \\*[hd*mark]
  684. .as hd*mark \ \ \"            add spaces between mark and heading
  685. .if !\\n[hd*arg1] \{\
  686. .    ds hd*mark\"        no mark for unnumbered
  687. .    ds hd*toc-mark
  688. .\}
  689. .\"
  690. .if \\n[D]>1 .tm At header \\*[hd*toc-mark] "\\$2"
  691. .nr hd*htype 0                \" hd*htype = check break and space
  692. .                    \" 0 = run-in, 1 = break only, 2 = space
  693. .if \\n[hd*level]<=\\n[Hb] .nr hd*htype 1
  694. .if \\n[hd*level]<=\\n[Hs] .nr hd*htype 2
  695. .                    \" two spaces if hd*htype == 0
  696. .ie (\\n[hd*htype]=0)&(\w@\\$2@) .ds hd*suf-space "  \"
  697. .el .ds hd*suf-space
  698. .\" Header "need space" is calculated as follows (in order):
  699. .\"      1v at current .vs assumed for first line of following para.
  700. .\"        (ie. ensure "keep with next")
  701. .\"    + 1 blank vertical space if space after heading (0.5v troff, 1v nroff)
  702. .\"    + height of heading at heading point size
  703. .nr hd*need 1v                \" hd*need = header need space
  704. .if \\n[hd*htype]>=2 .nr hd*need +1v/\\n[@ntc]u\"    add some extra space
  705. .\"---------- user macro HX ------------
  706. .\" user exit macro to override numbering
  707. .if d HX .HX \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  708. .par@reset-num \\n[hd*level]\"            reset numbered paragraph
  709. .if \\n[hd*htype] .na \"        no adjust if run-in
  710. .hd@split hd*font \\n[hd*level] HF \\*[HF]\"    get font for this level
  711. .ft \\*[hd*font]\"            set new font
  712. .\" .nr hd*ps-save \\n[.ps]u
  713. .hd@split hd*new-ps \\n[hd*level] HP \\*[HP]\"    get point size
  714. .ie (\\*[hd*new-ps]=0):(\w@\\*[hd*new-ps]@=0) \{\
  715. .    if \\n[hd*htype] \{\
  716. .        if '\\*[hd*font]'3' .S -1
  717. .        if '\\*[hd*font]'B' .S -1
  718. .    \}
  719. .\}
  720. .el .S \\*[hd*new-ps]
  721. .\" Do additional pre-space proportional to heading point size
  722. .\" but only if normal pre-space didn't cause a new page trap
  723. .nr hd*cur-bline \\n[nl]
  724. .if \\n[hd*cur-bline]>\\n[pg*top-nl] \{\
  725. .    ie \\n[hd*level]<=\\n[Hps] .SP \\*[Hpps2]
  726. .    el .SP \\*[Hpps1]
  727. .\}
  728. .di hd*div
  729. \\*[hd*mark]\\$2\\$3\\*[hd*suf-space]
  730. .br
  731. .di
  732. .rm hd*div
  733. .ne \\n[hd*need]u+\\n[dn]u+.5p  \"    this is the needed space for a header
  734. .\"---------- user macro HY ------------- 
  735. .\"    user macro to reset indents
  736. .if d HY .HY \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  737. .nr hd*mark-size \w'\\*[hd*mark]'
  738. .if (\\n[hd*level]<=\\n[Hc])&\\n[hd*htype] .ce\" center if level<=Hc
  739. .\"
  740. .\"    finally, output the header
  741. \\*[hd*mark]\&\c
  742. .\"    and the rest of the header
  743. .ie \\n[hd*htype] \{\
  744. \\$2\\$3
  745. .    br
  746. .\}
  747. .el \\$2\\$3\\*[hd*suf-space]\&\c
  748. .ft 1
  749. .S P P
  750. .\"
  751. .\" table of contents
  752. .if (\\n[hd*level]<=\\n[Cl])&\w@\\$2@ \{\
  753. .    toc@save \\n[hd*level] "\\*[hd*toc-mark]" "\\$2" "\\*[pg*toc-pn-fmt]"
  754. .\}
  755. .\"    set adjust to previous value
  756. .SA
  757. .\"    do break or space
  758. .if \\n[hd*htype] .br
  759. .if \\n[hd*htype]>1 .SP 1/\\n[@ntc]u
  760. .if \\n[hd*htype] \{\
  761. .    \"    indent if Hi=1 and Pt=1
  762. .    if (\\n[Hi]=1)&(\\n[Pt]=1) .ti +\\n[Pi]n
  763. .    \"    indent size of mark if Hi=2
  764. .    if \\n[hd*htype]&(\\n[Hi]>1) .ti +\\n[hd*mark-size]u
  765. .\}
  766. .nr par@ind-flag 0            \" no indent on .P if Pt=2
  767. .\"
  768. .\"    check if it is time to reset footnotes
  769. .if (\\n[hd*level]=1)&\\n[ft*clear-at-header] .nr ft*nr 0 1
  770. .\"
  771. .\"    check if it is time to reset indexes
  772. .if (\\n[hd*level]=1)&(\\n[pg*label-reset]) \{\
  773. .    nr lix*fg-nr 0 1
  774. .    nr lix*tb-nr 0 1
  775. .    nr lix*ec-nr 0 1
  776. .    nr lix*ex-nr 0 1
  777. .\}
  778. .\"---------- user macro HZ ----------
  779. .if d HZ .HZ \\n[hd*level] \\n[hd*arg1] "\\$2\\$3"
  780. .nr hd*last-pos \\n[nl]
  781. .nr hd*last-hpos \\n[.k]
  782. .nr par@ind-flag 0
  783. ..
  784. .\"--------
  785. .de HM
  786. .nr hd*i 0 1
  787. .while \\n+[hd*i]<8 .af H\\n[hd*i] \\$[\\n[hd*i]] 1
  788. ..
  789. .\"########### module pg ####################
  790. .\" set end of text trap
  791. .wh 0 pg@header
  792. .em pg@end-of-text
  793. .\"
  794. .ds pg*header ''- % -''
  795. .ds pg*even-footer
  796. .ds pg*odd-footer
  797. .ds pg*even-header
  798. .ds pg*odd-header
  799. .ds pg*footer
  800. .\"
  801. .nr pg*top-margin 0
  802. .nr pg*foot-margin 0
  803. .nr pg*block-size 0
  804. .nr pg*footer-size 5\"             1v+footer+even/odd footer+2v
  805. .nr pg*header-size 7\"             3v+header+even/odd header+2v
  806. .nr ft*note-size 0
  807. .nr pg*cur-column 0
  808. .nr pg*cols-per-page 1
  809. .nr pg*cur-po \n[@po]
  810. .nr pg*head-mark 0
  811. .nr pg*sect-reset 0
  812. .nr pg*ref-reset 0
  813. .nr pg*label-reset 0
  814. .ds pg*toc-pn-fmt "\\\\n[P]
  815. .nr pg*top-nl 0
  816. .\"
  817. .nr pg*ps \n[@ps]
  818. .nr pg*vs \n[@vs]
  819. .\" compatibility reasons. Why not use %??
  820. .aln P %
  821. .\"-------------------------
  822. .\" footer traps: set, enable and disable
  823. .de pg@set-new-trap
  824. .nr pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v)
  825. .if \\n[D]>2 .tm pg*foot-trap \\n[@pl]u-(\\n[pg*block-size]u+\\n[ft*note-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v) = \\n[pg*foot-trap]
  826. .\" last-pos points to the position of the footer and bottom 
  827. .\" block below foot-notes.
  828. .nr pg*last-pos \\n[@pl]u-(\\n[pg*block-size]u+\\n[pg*foot-margin]u+\\n[pg*footer-size]v)
  829. ..
  830. .de pg@enable-trap
  831. .wh \\n[pg*foot-trap]u pg@footer
  832. .if \\n[D]>2 .tm pg@enable-trap .t=\\n[.t] nl=\\n[nl]
  833. ..
  834. .de pg@disable-trap
  835. .ch pg@footer
  836. ..
  837. .\" move to new trap (if changed).
  838. .de pg@move-trap
  839. .pg@disable-trap
  840. .pg@set-new-trap
  841. .pg@enable-trap
  842. ..
  843. .de pg@enable-top-trap
  844. .\" set trap for pageheader.
  845. .nr pg*top-enabled 1
  846. ..
  847. .de pg@disable-top-trap
  848. .\" remove trap for pageheader.
  849. .nr pg*top-enabled 0
  850. ..
  851. .\" no header on the next page
  852. .de PGNH
  853. .nr pg*top-enabled -1
  854. ..
  855. .\" set first trap for pagefooter
  856. .pg@enable-top-trap
  857. .pg@set-new-trap
  858. .pg@enable-trap
  859. .\"-------------------------
  860. .\" stop output and begin on next page. Fix footnotes and all that.
  861. .de pg@next-page
  862. .\".debug next-page
  863. .ne 999i        \" activate trap
  864. .\" .pg@footer
  865. ..
  866. .\"-------------------------
  867. .\" support for PX and TP
  868. .als }t pg*header
  869. .als }e pg*even-header
  870. .als }o pg*odd-header
  871. .\"------------------------------------------------------------
  872. .\" HEADER
  873. .de pg@header
  874. .if \\n[D]>1 .tm Page# \\n[%] (\\n[.F]:\\n[c.])
  875. .if \\n[Idxf] \{\
  876. .tl '<pagenr\ \\n[%]>'''
  877. .\}
  878. .nr pg*top-nl \\n[nl]
  879. .if \\n[pg*top-enabled] \{\
  880. .    if \\n[pg*top-margin] .sp \\n[pg*top-margin]u
  881. .    ev pg*tl-ev
  882. .    pg@set-env
  883. .    ie !d TP \{\
  884. '        sp 3
  885. .        lt \\n[@ll]u
  886. .        ie (\\n[%]=1)&((\\n[N]=1):(\\n[N]=2)) \{\
  887. .            tl ''''
  888. .        \}
  889. .        el \{\
  890. .            tl \\*[pg*header]
  891. .            ie o .tl \\*[pg*odd-header]
  892. .            el .tl \\*[pg*even-header]
  893. .        \}
  894. '        sp 2
  895. .    \}
  896. .    el .TP
  897. .    ev
  898. .    \" why no-space??
  899. .    if d PX \{\
  900. .        ns
  901. .        PX
  902. .        rs
  903. .    \}
  904. .    nr pg*top-nl \\n[nl]
  905. .    \" check for pending footnotes 
  906. .    ft@check-old
  907. .    \"
  908. .    \" back to normal text processing
  909. .    \" .pg@enable-trap
  910. .    \" mark for multicolumn
  911. .    nr pg*head-mark \\n[nl]u
  912. .    \" set multicolumn
  913. .    \" 
  914. .    pg@set-po
  915. .    \" print floating displays
  916. .    ds@print-float 4
  917. .    tbl@top-hook
  918. .\}
  919. .if \\n[pg*top-enabled]<0 .nr pg*top-enabled 1
  920. ..
  921. .\"---------------------------------------------------------
  922. .\" FOOTER
  923. .de pg@footer
  924. .pg@disable-trap
  925. .\".debug footer
  926. .tbl@bottom-hook
  927. .\" increment pageoffset for MC
  928. .\" move to the exact start of footer.
  929. 'sp |\\n[pg*foot-trap]u+1v
  930. .\"
  931. .if \\n[D]>3 .tm FOOTER after .sp
  932. .\" print footnotes
  933. .if d ft*div .ft@print
  934. .\"
  935. .pg@inc-po
  936. .if !\\n[pg*cur-column] .pg@print-footer
  937. .\" next column
  938. .pg@set-po
  939. .pg@enable-trap
  940. ..
  941. .\"-------------------------
  942. .de pg@print-footer
  943. .\" jump to the position just below the foot-notes.
  944. 'sp |\\n[pg*last-pos]u+1v
  945. .\" check if there are any bottom block
  946. .if d pg*block-div .pg@block
  947. .\"
  948. .\" print the footer and eject new page
  949. .ev pg*tl-ev
  950. .pg@set-env
  951. .lt \\n[@ll]u
  952. .ie (\\n[%]=1)&(\\n[N]=1) \{\
  953. .    tl \\*[pg*header]
  954. .\}
  955. .el \{\
  956. .    ie o .tl \\*[pg*odd-footer]
  957. .    el .tl \\*[pg*even-footer]
  958. .    tl \\*[pg*footer]
  959. .\}
  960. .ev
  961. .ie (\\n[ds*fnr]>=\\n[ds*o-fnr]):\\n[ft*exist] \{\
  962. .    ev ne
  963. '    bp
  964. .    ev
  965. .\}
  966. .el 'bp
  967. ..
  968. .\"-------------------------
  969. .\"
  970. .\" Initialize the title environment
  971. .de pg@set-env
  972. 'na
  973. 'nh
  974. 'in 0
  975. 'ti 0
  976. 'ps \\n[pg*ps]
  977. 'vs \\n[pg*vs]
  978. ..
  979. .\"-------------------------
  980. .de PH
  981. .ds pg*header "\\$1
  982. .pg@set-new-size
  983. ..
  984. .de PF
  985. .ds pg*footer "\\$1
  986. .pg@set-new-size
  987. ..
  988. .de OH
  989. .ds pg*odd-header "\\$1
  990. .pg@set-new-size
  991. ..
  992. .de EH
  993. .ds pg*even-header "\\$1
  994. .pg@set-new-size
  995. ..
  996. .de OF
  997. .ds pg*odd-footer "\\$1
  998. .pg@set-new-size
  999. ..
  1000. .de EF
  1001. .ds pg*even-footer "\\$1
  1002. .pg@set-new-size
  1003. ..
  1004. .de pg@clear-hd
  1005. .ds pg*even-header
  1006. .ds pg*odd-header
  1007. .ds pg*header
  1008. ..
  1009. .de pg@clear-ft
  1010. .ds pg*even-footer
  1011. .ds pg*odd-footer
  1012. .ds pg*footer
  1013. ..
  1014. .de pg@set-new-size
  1015. .nr pg*ps \\n[@ps]
  1016. .nr pg*vs \\n[@vs]
  1017. .pg@move-trap
  1018. ..
  1019. .\"-------------------------
  1020. .\" Section-page as footer, new page for section
  1021. .if \n[N]=3 \{\
  1022. .    nr Ej 1
  1023. .    nr pg*sect-reset 1
  1024. .    nr pg*ref-reset 1
  1025. .    ds pg*toc-pn-fmt "\\\\n[H1]-\\\\n[P]
  1026. .    PF "''\\\\n[H1]-\\\\n[P]''"
  1027. .    PH
  1028. .\}
  1029. .\" No headers unless user sets it with .PH
  1030. .if \n[N]=4 \{\
  1031. .    PH
  1032. .    nr N 0
  1033. .\}
  1034. .\" Section-page as footer, new page for section, reset label numbers
  1035. .if \n[N]=5 \{\
  1036. .    nr Ej 1
  1037. .    nr pg*sect-reset 1
  1038. .    nr pg*ref-reset 1
  1039. .    nr pg*label-reset 1
  1040. .    ds pg*toc-pn-fmt "\\\\n[H1]-\\\\n[P]
  1041. .    PF "''\\\\n[H1]-\\\\n[P]''"
  1042. .    PH
  1043. .\}
  1044. .\"-------------------------
  1045. .\" end of page processing
  1046. .de pg@footnotes
  1047. .\".debug footnotes
  1048. .\" output footnotes. set trap for block
  1049. .\"
  1050. ..
  1051. .\"-------------------------
  1052. .\" print bottom block
  1053. .de pg@block
  1054. .ev pg*block-ev
  1055. 'nf
  1056. 'in 0
  1057. .ll 100i
  1058. .pg*block-div
  1059. .br
  1060. .ev
  1061. ..
  1062. .\"-------------------------
  1063. .\" define bottom block
  1064. .de BS
  1065. .misc@ev-keep pg*block-ev
  1066. .init@reset
  1067. .br
  1068. .di pg*block-div
  1069. ..
  1070. .\"-------------------------
  1071. .de BE
  1072. .br
  1073. .di
  1074. .nr pg*block-size \\n[dn]u
  1075. .ev
  1076. .pg@move-trap
  1077. ..
  1078. .\"-------------------------
  1079. .\" print out all pending text
  1080. .de pg@end-of-text
  1081. .\" non-empty environment
  1082. .misc@ev-keep ne
  1083. .init@reset
  1084. \c
  1085. .ds@print-float 3
  1086. .ev
  1087. .if d ref*div .RP 0 1\" No break after (last page)
  1088. ..
  1089. .\"-------------------------
  1090. .\" set top and bottom margins $$$ (not implemented yet)
  1091. .de VM
  1092. ..
  1093. .\"---------------------
  1094. .\" multicolumn output. 
  1095. .de pg@set-po
  1096. .if \\n[pg*cols-per-page]>1 \{\
  1097. .    ll \\n[pg*column-size]u
  1098. .\}
  1099. ..
  1100. .de pg@inc-po
  1101. .if \\n[pg*cols-per-page]>1 \{\
  1102. .    ie \\n+[pg*cur-column]>=\\n[pg*cols-per-page] \{\
  1103. .        nr pg*cur-column 0 1
  1104. .        nr pg*cur-po \\n[@po]u
  1105. .        po \\n[@po]u
  1106. .        ll \\n[@ll]u
  1107. .    \}
  1108. .    el \{\
  1109. .        nr pg*cur-po +(\\n[pg*column-size]u+\\n[pg*column-sep]u)
  1110. .        po \\n[pg*cur-po]u
  1111. '        sp |\\n[pg*head-mark]u
  1112. .    \}
  1113. .\}
  1114. ..
  1115. .de 1C
  1116. .br
  1117. .if \\n[pg*cols-per-page]<=1 .@error "1C: multicolumn mode not active"
  1118. .nr pg*cols-per-page 1
  1119. .nr pg*column-sep 0
  1120. .nr pg*column-size \\n[@ll]
  1121. .nr pg*cur-column 0 1
  1122. .nr pg*cur-po \\n[@po]u
  1123. .PGFORM
  1124. .\".pg@next-page
  1125. .SK
  1126. ..
  1127. .de 2C
  1128. .br
  1129. .nr pg*head-mark \\n[nl]u
  1130. .if \\n[pg*cols-per-page]>1 .@error "2C: multicolumn mode already active"
  1131. .nr pg*cols-per-page 2
  1132. .nr pg*column-sep \\n[@ll]/15
  1133. .nr pg*column-size (\\n[@ll]u*7)/15
  1134. .nr pg*cur-column 0 1
  1135. .nr pg*cur-po \\n[@po]u
  1136. .ll \\n[pg*column-size]u
  1137. ..
  1138. .\" MC column-size [ column-separation ]
  1139. .de MC
  1140. .br
  1141. .nr pg*head-mark \\n[nl]u
  1142. .if \\n[pg*cols-per-page]>1 .@error "MC: multicolumn mode already active"
  1143. .ie ''\\$1' .nr pg*column-size \\n[.l]
  1144. .el .nr pg*column-size (n;\\$1)
  1145. .ie ''\\$2' .nr pg*column-sep \\n[pg*column-size]/15
  1146. .el .nr pg*column-sep (n;\\$2)
  1147. .\"
  1148. .nr pg*cols-per-page (u;\\n[.l]/(\\n[pg*column-size]+\\n[pg*column-sep]+1))
  1149. .nr pg*cur-column 0 1
  1150. .nr pg*cur-po \\n[@po]u
  1151. .ll \\n[pg*column-size]u
  1152. ..
  1153. .\" skip pages
  1154. .de SK
  1155. .br
  1156. .bp
  1157. .nr pg*i 0 1
  1158. .while \\n+[pg*i]<=(0\\$1) .bp
  1159. ..
  1160. .\"-----------
  1161. .de OP
  1162. .br
  1163. .ie o .if !\\n[pg*head-mark]=\\n[nl] .bp +2
  1164. .el .bp
  1165. ..
  1166. .\"########### module footnotes ###################
  1167. .nr ft*note-size 0
  1168. .nr ft*busy 0
  1169. .nr ft*nr 0 1
  1170. .nr ft*wide 0
  1171. .nr ft*format 0
  1172. .nr ft*hyphen 0\"    hyphenation value
  1173. .nr ft*adjust 1\"    >0 if adjust true
  1174. .nr ft*indent 1\"    >0 if text indent true (not imp. $$$)
  1175. .nr ft*just 0\"    0=left justification, 1=right (not imp. $$$)
  1176. .nr ft*exist 0\"    not zero if there are any footnotes to be printed
  1177. .nr ft*clear-at-header 0\" >0 if footnotes should be reset at first level head.
  1178. .\"
  1179. .ds F \v'-.4m'\s-3\\n+[ft*nr]\s0\v'.4m'
  1180. .\"
  1181. .\"-----------------
  1182. .\" init footnote environment
  1183. .de ft@init
  1184. .\" indentcontrol not implemented $$$
  1185. .\" label justification not implemented $$$
  1186. 'in 0
  1187. 'fi
  1188. .ie \\n[ft*adjust] 'ad
  1189. .el 'na
  1190. .ie \\n[ft*hyphen] 'hy 14
  1191. .el 'hy 0
  1192. .ll \\n[@cur-ll]u
  1193. .ps (\\n[@ps]-2)
  1194. .vs (\\n[@vs]-1)
  1195. ..
  1196. .\"-----------------
  1197. .\" set footnote format
  1198. .\" no support for two column processing (yet). $$$
  1199. .de FD
  1200. .if \\n[.$]=0 .@error "FD: bad arg \\$1"
  1201. .if \w'\\$1' \{\
  1202. .    ie \\$1>11 .nr ft*format 0
  1203. .    el .nr ft*format \\$1
  1204. .\}
  1205. .\"
  1206. .ie \\n[.$]=2 .nr ft*clear-at-header 1
  1207. .el .nr ft*clear-at-header 0
  1208. .\"
  1209. .nr ft*hyphen (\\n[ft*format]%2)*14
  1210. .nr ft*format \\n[ft*format]/2
  1211. .\"
  1212. .nr ft*adjust 1-(\\n[ft*format]%2)
  1213. .nr ft*format \\n[ft*format]/2
  1214. .\"
  1215. .nr ft*indent 1-(\\n[ft*format]%2)
  1216. .nr ft*format \\n[ft*format]/2
  1217. .\"
  1218. .nr ft*just \\n[ft*format]%2
  1219. ..
  1220. .\"---------------
  1221. .\" Footnote and display width control $$$
  1222. .de WC
  1223. .nr ft*i 0 1
  1224. .while \\n+[ft*i]<=\\n[.$] \{\
  1225. .    ds ft*x \\$[\\n[ft*i]]
  1226. .    if '\\*[ft*x]'N' \{\
  1227. .        nr ft*wide 0
  1228. .        nr ft*first-fn 0
  1229. .        nr ds*wide 0
  1230. .        nr ds*float-break 1
  1231. .    \}
  1232. .    if '\\*[ft*x]'-WF' .nr ft*wide 0
  1233. .    if '\\*[ft*x]'WF' .nr ft*wide 1
  1234. .    if '\\*[ft*x]'-FF' .nr ft*first-fn 0
  1235. .    if '\\*[ft*x]'FF' .nr ft*first-fn 1
  1236. .    if '\\*[ft*x]'-WD' .nr ds*wide 0
  1237. .    if '\\*[ft*x]'WD' .nr ds*wide 1
  1238. .    if '\\*[ft*x]'-FB' .nr ds*float-break 0
  1239. .    if '\\*[ft*x]'FB' .nr ds*float-break 1
  1240. .\}
  1241. ..
  1242. .\"-----------------
  1243. .\" begin footnote
  1244. .de FS
  1245. .if \\n[ft*busy] .@error "FS: missing FE"
  1246. .nr ft*busy 1
  1247. .ev ft*ev
  1248. .ft@init
  1249. .if !\\n[ft*wide] .pg@set-po
  1250. .if !d ft*div .ft@init-footnote
  1251. .di ft*tmp-div
  1252. .nr ft*space \\n[Fs]v/2u
  1253. .sp \\n[ft*space]u
  1254. .\" print mark
  1255. .ie \\n[.$] .ds ft*mark \\$1
  1256. .el .ds ft*mark \\n[ft*nr].
  1257. \\*[ft*mark]
  1258. .in +.75c
  1259. .sp -1
  1260. .nr ft*exist 1
  1261. ..
  1262. .\"-----------------
  1263. .\" init footnote diversion
  1264. .de ft@init-footnote
  1265. .di ft*div
  1266. \l'20n'
  1267. .br
  1268. .di
  1269. .nr ft*note-size \\n[dn]
  1270. ..
  1271. .\"-----------------
  1272. .\" end footnote
  1273. .de FE
  1274. .nr ft*busy 0
  1275. .br
  1276. .di
  1277. 'in 0
  1278. 'nf
  1279. .if \\n[@pl]u<\\n[dn]u .@error "FE: too big footnote"
  1280. .ie (\\n[pg*foot-trap]u-\\n[.d]u)<\\n[dn]u \{\
  1281. .    da ft*next-div
  1282. .    ft*tmp-div
  1283. .    br
  1284. .    di
  1285. .\}
  1286. .el \{\
  1287. .    da ft*div
  1288. .    ft*tmp-div
  1289. .    di
  1290. .    nr ft*note-size +\\n[dn]
  1291. .\}
  1292. .rm ft*tmp-div
  1293. .ev
  1294. .pg@move-trap
  1295. ..
  1296. .\"-----------------
  1297. .\" print footnotes, see pg@footer
  1298. .de ft@print
  1299. .ev ft*print-ev
  1300. 'nf
  1301. 'in 0
  1302. .ll 100i
  1303. .ft*div
  1304. .br
  1305. .ev
  1306. .rm ft*div
  1307. .nr ft*note-size 0
  1308. .pg@move-trap
  1309. ..
  1310. .\"-----------------
  1311. .\" check if any pending footnotes, see pg@header
  1312. .de ft@check-old
  1313. .if d ft*next-div \{\
  1314. .    ev ft*ev
  1315. .    ft@init
  1316. .    ft@init-footnote
  1317. .    nf
  1318. .    in 0
  1319. .    da ft*div
  1320. .    ft*next-div
  1321. .    di
  1322. .    nr ft*note-size +\\n[dn]
  1323. .    rm ft*next-div
  1324. .    ev
  1325. .    nr ft*exist 0
  1326. .    pg@move-trap
  1327. .\}
  1328. ..
  1329. .\"########### module display ###################
  1330. .nr ds*wide 0\"        >0 if wide displays wanted
  1331. .nr ds*fnr 0 1\"    floating display counter
  1332. .nr ds*o-fnr 1\"    floating display counter, already printed
  1333. .nr ds*snr 0 1\"    static display counter
  1334. .nr ds*lvl 0 1\"    display level
  1335. .nr ds*float-busy 0\"    >0 if printing float
  1336. .nr ds*ffloat 0\"    >0 if DF, 0 if DS
  1337. .\" static display start
  1338. .\" nested DS/DE is allowed. No limit on depth.
  1339. .de DS
  1340. .br
  1341. .ds@start 0 DS \\$@
  1342. ..
  1343. .\" floating display start
  1344. .\" nested DF/DE is not allowed.
  1345. .de DF
  1346. .if \\n[ds*lvl] .@error "DF:nested floating is not allowed. Use DS."
  1347. .ds@start 1 DF \\$@
  1348. ..
  1349. .\"---------------
  1350. .nr ds*format 0\"    dummy value for .En/.EQ
  1351. .nr ds*format! 0\"    no indent
  1352. .nr ds*format!0 0\"    no indent
  1353. .nr ds*format!L 0\"    no indent
  1354. .nr ds*format!I 1\"    indent
  1355. .nr ds*format!1 1\"    indent
  1356. .nr ds*format!C 2\"    center each line
  1357. .nr ds*format!2 2\"    center each line
  1358. .nr ds*format!CB 3\"    center as block
  1359. .nr ds*format!3 3\"    center as block
  1360. .nr ds*format!R 4\"    right justify each line
  1361. .nr ds*format!4 4\"    right justify each line
  1362. .nr ds*format!RB 5\"    right justify as block
  1363. .nr ds*format!5 5\"    right justify as block
  1364. .\"---------------
  1365. .nr ds*fill! 0\"    no fill
  1366. .nr ds*fill!N 0\"    no fill
  1367. .nr ds*fill!0 0\"    no fill
  1368. .nr ds*fill!F 1\"    fill on
  1369. .nr ds*fill!1 1\"    fill on
  1370. .\"---------------
  1371. .de ds@start
  1372. .nr ds*ffloat \\$1
  1373. .ds ds*type \\$2
  1374. .shift 2
  1375. .nr ds*lvl +1
  1376. .\" get format of the display
  1377. .ie \\n[.$] \{\
  1378. .    ie r ds*format!\\$1 .nr ds*format \\n[ds*format!\\$1]
  1379. .    el .@error "\\*[ds*type]:wrong format:\\$1"
  1380. .\}
  1381. .el .nr ds*format 0
  1382. .\" fill or not to fill, that is the...
  1383. .nr ds*fill 0
  1384. .ie \\n[.$]>1 \{\
  1385. .    ie r ds*fill!\\$2 .nr ds*fill \\n[ds*fill!\\$2]
  1386. .    el .@error "\\*[ds*type]:wrong fill:\\$2"
  1387. .\}
  1388. .nr ds*rindent 0
  1389. .if \\n[.$]>2 .nr ds*rindent \\$3
  1390. .\"
  1391. .\"
  1392. .nr ds*old-ll \\n[.l]
  1393. .misc@push ds-ll \\n[.l]
  1394. .misc@push ds-form \\n[ds*format]
  1395. .misc@push ds-ffloat \\n[ds*ffloat]
  1396. .nr ds*i \\n[.i]
  1397. .nr ds*ftmp \\n[.f]
  1398. .misc@ev-keep ds*ev!\\n+[ds*snr]
  1399. .ft \\n[ds*ftmp]
  1400. .\"
  1401. .init@reset
  1402. 'in \\n[ds*i]u
  1403. .di ds*div!\\n[ds*snr]
  1404. .\"
  1405. .ll \\n[ds*old-ll]u
  1406. .if \\n[ds*rindent] .ll -\\n[ds*rindent]n
  1407. .if \\n[ds*wide] .ll \\n[@ll]u
  1408. .\"
  1409. .ie \\n[ds*fill] 'fi
  1410. .el 'nf
  1411. .\"
  1412. .if \\n[ds*format]=1 \{\
  1413. .    ll -\\n[Si]n
  1414. '    in +\\n[Si]n
  1415. .\}
  1416. .if (\\n[ds*format]=3):(\\n[ds*format]=5) 'in 0
  1417. ..
  1418. .\"---------------
  1419. .de DE
  1420. .if \\n-[ds*lvl]<0 .@error "DE: no corresponding DS or DF"
  1421. .br
  1422. .if \\n[ds*ffloat] .SP \\n[Lsp]u
  1423. .di
  1424. .nr ds*width \\n[dl]
  1425. .nr ds*height \\n[dn]
  1426. .misc@pop-nr ds-ll ds*old-ll
  1427. .misc@pop-nr ds-form ds*format
  1428. .misc@pop-nr ds-ffloat ds*ffloat
  1429. .if (\\n[ds*format]>=2)&(\\n[ds*width]>\\n[ds*old-ll]) \{\
  1430. .    @error "DE: display too wide for current line-length"
  1431. .\}
  1432. .\" prepare copy to floating display
  1433. .if \\n[ds*ffloat] .di ds*fdiv!\\n+[ds*fnr]
  1434. .\"
  1435. 'in 0
  1436. 'nf
  1437. .if \\n[ds*format]=2 'ce 9999
  1438. .if \\n[ds*format]=3 'in (u;(\\n[ds*old-ll]-\\n[ds*width])/2)
  1439. .if \\n[ds*format]=4 'rj 9999
  1440. .if \\n[ds*format]=5 'in (u;\\n[ds*old-ll]-\\n[ds*width])
  1441. .\"
  1442. .ie !\\n[ds*ffloat] \{\
  1443. .    \"
  1444. .    \"    Print static display
  1445. .    \"    Eject page if display will fit one page and
  1446. .    \"    there are less than half of the page left.
  1447. .    nr ds*i \\n[pg*foot-trap]-\\n[pg*header-size]v
  1448. .    if (\\n[ds*height]>\\n[ds*i])&(\\n[.t]<(\\n[ds*i]/2)) \{\
  1449. .        ne \\n[.t]u+1v
  1450. .    \}
  1451. .    if (\\n[ds*height]<\\n[ds*i])&(\\n[.t]<(\\n[ds*height])) \{\
  1452. .        ne \\n[.t]u+1v
  1453. .    \}
  1454. .    if \\n[Ds] .SP \\n[Lsp]u
  1455. .\}
  1456. .el .SP \\n[Lsp]u
  1457. .ds*div!\\n[ds*snr]
  1458. .ie !\\n[ds*ffloat] .if \\n[Ds] .SP \\n[Lsp]u
  1459. .el \{\
  1460. .    SP \\n[Lsp]u
  1461. .    di
  1462. .\}
  1463. .if \\n[ds*format]=2 'ce 0
  1464. .if \\n[ds*format]=4 'rj 0
  1465. .rm ds*div!\\n[ds*snr]
  1466. .nr ds*snr -1
  1467. .nr par@ind-flag 0
  1468. .\"        move div to the floating display list
  1469. .ev
  1470. .if \\n[ds*ffloat] \{\
  1471. .    nr ds*fsize!\\n[ds*fnr] \\n[dn]
  1472. .    \" print float if queue is empty and the display fits into
  1473. .    \" the current page
  1474. .    if (\\n[ds*fnr]>\\n[ds*o-fnr])&(\\n[ds*height]<\\n[.t]) \{\
  1475. .        ds@print-float 1
  1476. .    \}
  1477. .\}
  1478. ..
  1479. .\"---------------
  1480. .\" print according to Df and De.
  1481. .\" .ds@print-float type
  1482. .\"    type    called from
  1483. .\"    1    .DE
  1484. .\"    2    end of section
  1485. .\"    3    end of document
  1486. .\"    4    beginning of new page
  1487. .\"
  1488. .de ds@print-float
  1489. .if \\n[Df]>5 .@error "Df=\\n[Df], max value is 5"
  1490. .if !\\n[ds*float-busy] \{\
  1491. .    nr ds*float-busy 1
  1492. .\" at .DE
  1493. .    if (\\$1=1)&((\\n[Df]%2)=1) \{\
  1494. .        if \\n[.t]>\\n[ds*fsize!\\n[ds*fnr]] \{\
  1495. .            \" Df = 1,3 or 5
  1496. .            ds@print-one-float
  1497. .        \}
  1498. .    \}
  1499. .\" print all if Df<2 and end of section
  1500. .    if (\\$1=2)&(\\n[Df]<2) .ds@print-all-floats
  1501. .\" print all if end of document. Where should they go instead?
  1502. .    if \\$1=3 .ds@print-all-floats
  1503. .\" new page
  1504. .    if (\\$1=4)&(\\n[Df]>1) \{\
  1505. .        if \\n[Df]=2 .ds@print-one-float
  1506. .        if \\n[Df]=3 .ds@print-one-float
  1507. .        if \\n[Df]>3 \{\
  1508. .            ie \\n[De] .ds@print-all-floats
  1509. .            el .ds@print-this-page
  1510. .        \}
  1511. .    \}
  1512. .    nr ds*float-busy 0
  1513. .\}
  1514. ..
  1515. .\"---------------
  1516. .\" print a floating diversion
  1517. .de ds@output-div
  1518. .ev ds*fev
  1519. .in 0
  1520. .nf
  1521. .ds*fdiv!\\n[ds*o-fnr]
  1522. .ev
  1523. .rm ds*fdiv!\\n[ds*o-fnr]
  1524. .rm ds*fsize!\\n[ds*o-fnr]
  1525. .rm ds*fformat!\\n[ds*o-fnr]
  1526. .nr ds*o-fnr +1
  1527. ..
  1528. .\"---------------
  1529. .\" print one floating display if there is one.
  1530. .de ds@print-one-float
  1531. .if \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1532. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1533. .    ds@output-div
  1534. .    if \\n[De] .pg@next-page
  1535. .\}
  1536. ..
  1537. .\"---------------
  1538. .\" print all queued floats.
  1539. .\" if De>0 do a page eject between the floats.
  1540. .de ds@print-all-floats
  1541. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1542. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .pg@next-page
  1543. .    ds@output-div
  1544. .    if \\n[De] .pg@next-page
  1545. .\}
  1546. ..
  1547. .\"---------------
  1548. .\" print as many floats as will fit on the current page
  1549. .de ds@print-this-page
  1550. .while \\n[ds*o-fnr]<=\\n[ds*fnr] \{\
  1551. .    if \\n[.t]<\\n[ds*fsize!\\n[ds*o-fnr]] .break
  1552. .    ds@output-div
  1553. .\}
  1554. ..
  1555. .\"########### module list ###################
  1556. .\" .LI text-indent mark-indent pad type [mark [LI-space [LB-space] ] ]
  1557. .\"
  1558. .nr li*tind 0
  1559. .nr li*mind 0
  1560. .nr li*pad 0
  1561. .nr li*type 0
  1562. .ds li*mark 0
  1563. .nr li*li-spc 0
  1564. .nr li*lvl 0 1
  1565. .nr li*cur-vpos 0
  1566. .\"--------------------------
  1567. .\"    the major list-begin macro.
  1568. .\"    If type == -1 a 'break' will occur.
  1569. .de LB
  1570. .if \\n[.$]<4 .@error "LB: not enough arguments, min 4"
  1571. .misc@push cind \\n[.i]
  1572. .misc@push tind \\n[li*tind]
  1573. .misc@push mind \\n[li*mind]
  1574. .misc@push pad \\n[li*pad]
  1575. .misc@push type \\n[li*type]
  1576. .misc@push li-spc \\n[li*li-spc]
  1577. .ds li*mark-list!\\n[li*lvl] \\*[li*mark]
  1578. .nr li*lvl +1
  1579. .\"
  1580. .nr li*tind (n;0\\$1)\"            text-indent
  1581. .nr li*mind (n;0\\$2)\"            mark-indent
  1582. .nr li*pad (n;0\\$3)\"            pad
  1583. .nr li*type 0\\$4\"            type
  1584. .ds li*mark \\$5\"            mark
  1585. .ie !'\\$6'' .nr li*li-spc \\$6\"    LI-space
  1586. .el .nr li*li-spc 1
  1587. .ie !'\\$7'' .nr li*lb-spc \\$6\"    LB-space
  1588. .el .nr li*lb-spc 0
  1589. .\" init listcounter
  1590. .nr li*cnt!\\n[li*lvl] 0 1
  1591. .\" assign format
  1592. .af li*cnt!\\n[li*lvl] 1
  1593. .if \\n[li*type] .if !'\\*[li*mark]'' .af li*cnt!\\n[li*lvl] \\*[li*mark]
  1594. .\"
  1595. .if \\n[li*lb-spc] .SP \\n[li*lb-spc]v/\\n[@ntc]u
  1596. .in +\\n[li*tind]u
  1597. ..
  1598. .\"---------------
  1599. .de LI
  1600. .if \\n[li*lvl]<1 .@error "LI:no lists active"
  1601. .if \\n[li*li-spc]&(\\n[Ls]>=\\n[li*lvl]) .SP \\n[li*li-spc]v/\\n[@ntc]u
  1602. .ne 2v
  1603. .\"
  1604. .ds li*c-mark \\*[li*mark]
  1605. .nr li*cnt!\\n[li*lvl] +1
  1606. .if \\n[li*type]=1 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]].
  1607. .if \\n[li*type]=2 .ds li*c-mark \\n[li*cnt!\\n[li*lvl]])
  1608. .if \\n[li*type]=3 .ds li*c-mark (\\n[li*cnt!\\n[li*lvl]])
  1609. .if \\n[li*type]=4 .ds li*c-mark [\\n[li*cnt!\\n[li*lvl]]]
  1610. .if \\n[li*type]=5 .ds li*c-mark <\\n[li*cnt!\\n[li*lvl]]>
  1611. .if \\n[li*type]=6 .ds li*c-mark {\\n[li*cnt!\\n[li*lvl]]}
  1612. .if \\n[.$]=1 .ds li*c-mark \\$1
  1613. .if \\n[.$]=2 .ds li*c-mark \\$1\ \\*[li*c-mark]
  1614. .if '\\*[li*c-mark]'\ ' .ds li*c-mark
  1615. .\"
  1616. .\" determine where the text begins
  1617. .nr li*text-begin \\n[li*tind]>?\w'\\*[li*c-mark]\ '
  1618. .\"
  1619. .\" determine where the mark begin
  1620. .ie !\\n[li*pad] .nr li*in \\n[li*mind]
  1621. .el .nr li*in \\n[li*text-begin]-\\n[li*pad]-\w'\\*[li*c-mark]'
  1622. .if !\\n[li*in] .nr li*in 0
  1623. .\"
  1624. .ti -\\n[li*tind]u
  1625. .\" no indentation if hanging indent
  1626. .if (\w'\\*[li*c-mark]'=0)&((\\n[.$]=0):(\w'\\$1'=0)) .nr li*text-begin 0
  1627. \Z'\&\h'\\n[li*in]u'\\*[li*c-mark]'\h'\\n[li*text-begin]u'\&\c
  1628. .if \\n[li*type]=-1 .br
  1629. ..
  1630. .\"
  1631. .\"-------------
  1632. .de li@pop
  1633. .nr li*lvl -1
  1634. .misc@pop-nr cind li*tmp
  1635. .in \\n[li*tmp]u
  1636. .misc@pop-nr tind li*tind
  1637. .misc@pop-nr mind li*mind
  1638. .misc@pop-nr pad li*pad
  1639. .misc@pop-nr type li*type
  1640. .misc@pop-nr li-spc li*li-spc
  1641. .ds li*mark \\*[li*mark-list!\\n[li*lvl]]
  1642. ..
  1643. .de LE
  1644. .if \\n[li*lvl]<1 .@error "LE:mismatched"
  1645. .li@pop
  1646. .if '\\$1'1' .SP 1/\\n[@ntc]u
  1647. ..
  1648. .\"-------------
  1649. .\"    list status clear.
  1650. .de LC
  1651. .if !\\n[.$]=1 .@error "LC: no argument"
  1652. .if \\$1>\\n[li*lvl] .@error "LC: incorrect argument: \\$1 (too big)"
  1653. .while \\n[li*lvl]>\\$1 .li@pop
  1654. .nr par@ind-flag 0
  1655. ..
  1656. .\"-------------
  1657. .de AL
  1658. .if \\n[.$]>3 .@error "AL: too many arguments"
  1659. .if \\n[D]>2 .tm AL $*
  1660. .ie \\n[.$]<=1 .LB \\n[Li] 0 2 1 "\\$1"
  1661. .el \{\
  1662. .    ie \\n[.$]=2 .LB 0\\$2 0 2 1 "\\$1"
  1663. .    el \{\
  1664. .        ie !'\\$2'' .LB \\$2 0 2 1 "\\$1" 0 1
  1665. .        el .LB \\n[Li] 0 2 1 "\\$1" 0 1
  1666. .    \}
  1667. .\}
  1668. ..
  1669. .de ML
  1670. .if \\n[.$]>3 .@error "ML: too many arguments"
  1671. .if \\n[D]>2 .tm ML $*
  1672. .nr li*ml-width \w'\\$1'u+1n
  1673. .if \\n[.$]<2 .LB \\n[li*ml-width]u 0 1 0 "\\$1"
  1674. .if \\n[.$]=2 .LB 0\\$2 0 1 0 "\\$1"
  1675. .if \\n[.$]=3 \{\
  1676. .    ie '\\$2'' .LB \\n[li*ml-width]u 0 1 0 "\\$1" 0 1
  1677. .    el .LB \\n[Li] 0 1 0 "\\$1" 0 1
  1678. .\}
  1679. ..
  1680. .de VL
  1681. .if \\n[D]>2 .tm VL $*
  1682. .if \\n[.$]>3 .@error "VL: too many arguments"
  1683. .if \\n[.$]<1 .@error "VL: missing text-indent"
  1684. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 0
  1685. .el .LB 0\\$1 0\\$2 0 0 \& 0 1
  1686. ..
  1687. .\"    Bullet (for .BL)
  1688. .de BL
  1689. .if \\n[D]>2 .tm BL $*
  1690. .ds BU \s-2\(bu\s0
  1691. .if \\n[.$]>2 .@error "BL: too many arguments"
  1692. .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \\*[BU]
  1693. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \\*[BU]
  1694. .if \\n[.$]=2 \{\
  1695. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \\*[BU] 0 1
  1696. .    el .LB 0\\$1 0 1 0 \\*[BU] 0 1
  1697. .\}
  1698. ..
  1699. .de DL
  1700. .if \\n[D]>2 .tm DL $*
  1701. .if \\n[.$]>2 .@error "DL: too many arguments"
  1702. .if \\n[.$]<1 .LB \\n[Pi] 0 1 0 \(em
  1703. .if \\n[.$]=1 .LB 0\\$1 0 1 0 \(em
  1704. .if \\n[.$]=2 \{\
  1705. .    ie '\\$1'' .LB \\n[Pi] 0 1 0 \(em 0 1
  1706. .    el .LB 0\\$1 0 1 0 \(em 0 1
  1707. .\}
  1708. ..
  1709. .de RL
  1710. .if \\n[D]>2 .tm RL $*
  1711. .if \\n[.$]>2 .@error "RL: too many arguments"
  1712. .if \\n[.$]<1 .LB 6 0 2 4
  1713. .if \\n[.$]=1 .LB 0\\$1 0 2 4
  1714. .if \\n[.$]=2 \{\
  1715. .    ie '\\$1'' .LB 6 0 2 4 1 0 1
  1716. .    el .LB 0\\$1 0 2 4 1 0 1
  1717. .\}
  1718. ..
  1719. .\" Broken Variable List. As .VL but text begin on the next line
  1720. .de BVL
  1721. .if \\n[D]>2 .tm BVL $*
  1722. .if \\n[.$]>3 .@error "BVL: too many arguments"
  1723. .if \\n[.$]<1 .@error "BVL: missing text-indent"
  1724. .ie \\n[.$]<3 .LB 0\\$1 0\\$2 0 -1
  1725. .el .LB 0\\$1 0\\$2 0 -1 \& 0 1
  1726. ..
  1727. .\" ####### module tbl #######################################
  1728. .\" This module is copied from groff_ms and modified for mgm.
  1729. .\" Yes, it does not resemble the original anymore :-).
  1730. .\" Don't know if I missed something important.
  1731. .\" Groff_ms is written by James Clark.
  1732. .nr tbl*have-header 0
  1733. .nr tbl*header-written 0
  1734. .de TS
  1735. .br
  1736. .if '\\$1'H' .di tbl*header-div
  1737. ..
  1738. .de tbl@top-hook
  1739. .if \\n[tbl*have-header] \{\
  1740. .    ie \\n[.t]-\\n[tbl*header-ht]-1v .tbl@print-header
  1741. .    el .sp \\n[.t]u
  1742. .\}
  1743. ..
  1744. .de tbl@bottom-hook
  1745. .if \\n[tbl*have-header] \{\
  1746. .    nr T. 1
  1747. .\" draw bottom and side lines of boxed tables.
  1748. .    T#
  1749. .\}
  1750. .nr tbl*header-written 0
  1751. ..
  1752. .de tbl@print-header
  1753. .ev tbl*ev
  1754. 'nf
  1755. .tbl*header-div
  1756. .ev
  1757. .mk #T
  1758. .nr tbl*header-written 1
  1759. ..
  1760. .de TH
  1761. .ie '\\n[.z]'tbl*header-div' \{\
  1762. .    nr T. 0
  1763. .    T#
  1764. .    br
  1765. .    di
  1766. .    nr tbl*header-ht \\n[dn]
  1767. .    ne \\n[dn]u+1v
  1768. .    nr tbl*have-header 1
  1769. .    ie '\\$1'N' .if !\\n[tbl*header-written] .tbl@print-header
  1770. .    el .tbl@print-header
  1771. .\}
  1772. .el .@error ".TH without .TS H"
  1773. ..
  1774. .de TE
  1775. .ie '\\n(.z'tbl*header-div' .@error ".TS H but no .TH before .TE"
  1776. .el \{\
  1777. .    nr tbl*have-header 0
  1778. .\}
  1779. .\" reset tabs
  1780. .TAB
  1781. ..
  1782. .de T&
  1783. ..
  1784. .\" ####### module pic #######################################
  1785. .de PS
  1786. .nr pic*in 0
  1787. .br
  1788. .SP .5
  1789. .ie \\n[.$]<2 .@error "PS: bad arguments. Probably not processed with pic."
  1790. .el \{\
  1791. .    if !\\n[ds*lvl] .ne (u;\\$1)+1v
  1792. .\" should be contained between .DS/.DE
  1793. .if r ds*format \{\
  1794. .        if \\n[ds*lvl]&((\\n[ds*format]=2):(\\n[ds*format]=3)) \{\
  1795. .            nr pic*in \\n[.i]
  1796. .\" .        in +(u;\\n[.l]-\\n[.i]-\\$2/2)
  1797. .        \}
  1798. .    \}
  1799. .\}
  1800. ..
  1801. .de PE
  1802. .init@reset
  1803. .SP .5
  1804. ..
  1805. .\" ####### module eq #######################################
  1806. .\" 
  1807. .nr eq*number 0 1
  1808. .de EQ
  1809. .ds eq*lable "\\$1
  1810. .di eq*div
  1811. .misc@ev-keep eq*ev
  1812. .in 0
  1813. .nf
  1814. ..
  1815. .de EN
  1816. .br
  1817. .di
  1818. .ta
  1819. .\" equation with lable.
  1820. .if \\n[dl] \{\
  1821. .    br
  1822. .    chop eq*div
  1823. .    ie (\\n[Eq]%2) \{\
  1824. .        \"    lable to the left
  1825. .        if \\n[ds*format]<2 \{\
  1826. .            ta (u;(\\n[.l]/7)+\\n[.i]) \\n[.l]u\" L
  1827. \\*[eq*lable]\t\\*[eq*div]\t\&
  1828. .        \}
  1829. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1830. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]u\" C
  1831. \\*[eq*lable]\t\\*[eq*div]\t\&
  1832. .        \}
  1833. .        if \\n[ds*format]>3 \{\
  1834. .            ta \\n[.l]uR\"    R
  1835. \\*[eq*lable]\t\\*[eq*div]
  1836. .        \}
  1837. .    \}
  1838. .    el \{\
  1839. .        \"    lable to the right
  1840. .        if \\n[ds*format]<2 \{\
  1841. .            ta \\n[.l]uR\" L
  1842. \\*[eq*div]\t\\*[eq*lable]
  1843. .        \}
  1844. .        if (\\n[ds*format]=2):(\\n[ds*format]=3) \{\
  1845. .            ta (u;(\\n[.l]-\\n[.i])/2+\\n[.i])C \\n[.l]uR\" C
  1846. \t\\*[eq*div]\t\\*[eq*lable]
  1847. .        \}
  1848. .        if \\n[ds*format]>3 \{\
  1849. .            ta (\\n[.l]u-\w'\\*[eq*lable]'u-1m)R \\n[.l]uR\" R
  1850. \t\\*[eq*div]\t\\*[eq*lable]
  1851. .        \}
  1852. .    \}
  1853. .\}
  1854. .TAB
  1855. .ev
  1856. ..
  1857. .\"########### module toc ###################
  1858. .\" table of contents
  1859. .nr toc*slevel 1
  1860. .nr toc*spacing 1v/\n[@ntc]u
  1861. .nr toc*tlevel 2
  1862. .nr toc*tab 0
  1863. .\"-----------
  1864. .\" Table of contents with friends (module lix)
  1865. .de TC
  1866. .br
  1867. .\" print any pending displays
  1868. .pg@end-of-text
  1869. .if \w'\\$1'>0 .nr toc*slevel \\$1
  1870. .if \w'\\$2'>0 .nr toc*spacing \\$2v/\\n[@ntc]u
  1871. .if \w'\\$3'>0 .nr toc*tlevel \\$3
  1872. .if \w'\\$4'>0 .nr toc*tab \\$4
  1873. .if \\n[pg*cols-per-page]>1 .1C
  1874. .pg@clear-hd
  1875. .pg@next-page
  1876. .pg@clear-ft
  1877. .\"-------------
  1878. .if d Ci .toc@read-Ci \\*[Ci]
  1879. .nf
  1880. .in 0
  1881. .nr toc*pn 0 1
  1882. .af toc*pn i
  1883. .PF "''\\\\\\\\n+[toc*pn]''"
  1884. .nr toc*i 4 1
  1885. .while \\n+[toc*i]<10 \{\
  1886. .    if !'\\$\\n[toc*i]'' \{\
  1887. .        ce
  1888. \\$\\n[toc*i]
  1889. .        br
  1890. .    \}
  1891. .\}
  1892. .if \\n[.$]<=4 .if d TX .TX
  1893. .ie d TY .if \\n[.$]<=4 .TY
  1894. .el \{\
  1895. .    ce
  1896. \\*[Licon]
  1897. .    br
  1898. .    SP 3
  1899. .\}
  1900. .toc*list
  1901. .\" print LIST OF XXX
  1902. .if d lix*dsfg .lix@print-ds fg "\\*[Lf]"
  1903. .if d lix*dstb .lix@print-ds tb "\\*[Lt]"
  1904. .if d lix*dsec .lix@print-ds ec "\\*[Le]"
  1905. .if d lix*dsex .lix@print-ds ex "\\*[Lx]"
  1906. ..
  1907. .\"-----------
  1908. .\" .toc@read-Ci lev1 lev2 lev3 lev4 ... lev7
  1909. .de toc@read-Ci
  1910. .nr toc*i 0 1
  1911. .while \\n+[toc*i]<8 \{\
  1912. .    nr toc*hl!\\n[toc*i] \\$\\n[toc*i]
  1913. .\}
  1914. ..
  1915. .\"-----------
  1916. .de toc@save
  1917. .\" collect maxsize of mark if string Ci don't exist.
  1918. .if !d Ci \{\
  1919. .    if !r toc*hl!\\$1 .nr toc*hl!\\$1 0
  1920. .    if \\n[toc*hl!\\$1]<=\w'\\$2' \{\
  1921. .        nr toc*hl!\\$1 \w'\\$2'u+1m
  1922. .    \}
  1923. .\}
  1924. .am toc*list
  1925. .\" .toc@set level headernumber text pagenr
  1926. .toc@set \\$1 "\\$2" "\\$3" "\\$4"
  1927. \\..
  1928. ..
  1929. .\"-----------
  1930. .\" level mark text pagenumber
  1931. .de toc@set
  1932. .if \\$1<=\\n[toc*slevel] .SP \\n[toc*spacing]u
  1933. .ne 2v
  1934. .na
  1935. .fi
  1936. .nr toc*ind 0
  1937. .nr toc*i 0 1
  1938. .ie d Ci \{\
  1939. .    nr toc*ind +\\n[toc*hl!\\$1]u
  1940. .\}
  1941. .el \{\
  1942. .    while \\n+[toc*i]<\\$1 \{\
  1943. .        nr toc*ind +\\n[toc*hl!\\n[toc*i]]u
  1944. .    \}
  1945. .\}
  1946. .nr toc*text \\n[toc*ind]u+\\n[toc*hl!\\$1]u
  1947. .in \\n[toc*text]u
  1948. .ti -\\n[toc*hl!\\$1]u
  1949. .\"
  1950. .\" length of headernum space
  1951. .nr toc*i \\n[toc*hl!\\$1]-\w'\\$2'
  1952. .\"
  1953. .ll \\n[@ll]u-\w'\\$4'u-2m
  1954. .\" ragged right ---------------------------------
  1955. .ie \\$1>\\n[toc*tlevel] \{\
  1956. \\$2
  1957. .    sp -1
  1958. \\$3\ \ \ \\$4
  1959. .    br
  1960. .\}
  1961. .el \{\
  1962. .    \" unnumbered heading --------------------
  1963. .    ie '\\$2'' \{\
  1964. .        in \\n[toc*ind]u
  1965. \\$3\h'1m'
  1966. .    \}
  1967. .    \" normal heading ------------------------
  1968. .    el \{\
  1969. \\$2
  1970. .        sp -1
  1971. \\$3\h'1m'
  1972. .    \}
  1973. .    ll \\n[@ll]u
  1974. .    sp -1
  1975. .    nr toc*sep (u;\\n[.l]-\\n[.n]-\\n[.i]-\w'\\$4')-1m
  1976. \h'|\\n[.n]u'\l'\\n[toc*sep]u.'\h'1m'\\$4
  1977. .\}
  1978. .ll \\n[@ll]u
  1979. ..
  1980. .\"########################### module lix ############################
  1981. .\" LIST OF figures, tables, exhibits and equations 
  1982. .nr lix*fg-nr 0 1
  1983. .nr lix*tb-nr 0 1
  1984. .nr lix*ec-nr 0 1
  1985. .nr lix*ex-nr 0 1
  1986. .aln Fg lix*fg-nr
  1987. .aln Tb lix*tb-nr
  1988. .aln Ec lix*ec-nr
  1989. .aln Ex lix*ex-nr
  1990. .\"------------
  1991. .de FG
  1992. .lix@print-line fg Lf \\n+[lix*fg-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1993. ..
  1994. .de TB
  1995. .lix@print-line tb Lt \\n+[lix*tb-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1996. ..
  1997. .de EC
  1998. .lix@print-line ec Le \\n+[lix*ec-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  1999. ..
  2000. .de EX
  2001. .lix@print-line ex Lx \\n+[lix*ex-nr] "\\$1" "\\$2" "\\$3" "\\$4"
  2002. ..
  2003. .\"------------
  2004. .\" print line with 'figure' in the text
  2005. .\" type stringvar number text override flag refname
  2006. .de lix@print-line
  2007. .ds lix*text "\\$4
  2008. .ie !\\n[Of] .ds lix*ds-form .\ \ \"
  2009. .el .ds lix*ds-form "\ \(em\ \"
  2010. .nr lix*in \\n[.i]
  2011. .ds lix*lable \\*[Li\\$1]\ \\$3\\*[lix*ds-form]
  2012. .if !'\\$5'' \{\
  2013. .    if !0\\$6 .ds lix*lable \\*[Li\\$1]\ \\$5\\$3\\*[lix*ds-form]
  2014. .    if 0\\$6=1 .ds lix*lable \\*[Li\\$1]\ \\$3\\$5\\*[lix*ds-form]
  2015. .    if 0\\$6=2 .ds lix*lable \\*[Li\\$1]\ \\$5\\*[lix*ds-form]
  2016. .\}
  2017. .ds lix*pgnr \\n[%]
  2018. .\" print line if not between DS/DE
  2019. .ie \\n[ds*lvl]<1 .lix@print-text "\\*[lix*lable]" "\\*[lix*text]"
  2020. .el .lix@embedded-text "\\*[lix*lable]" "\\*[lix*text]"
  2021. .\"
  2022. .\" save line for LIST OF XXX
  2023. .if !r lix*wth\\$1 .nr lix*wth\\$1 0
  2024. .if \w'\\*[lix*lable]'>\\n[lix*wth\\$1] .nr lix*wth\\$1 \w'\\*[lix*lable]'
  2025. .if \\n[\\$2] .lix@ds-save \\$1 \\*[lix*pgnr] "\\$4" "\\*[lix*lable]"
  2026. .if !'\\$7'' .SETR \\$7 \\$3
  2027. ..
  2028. .\"-----------
  2029. .de lix@print-text
  2030. .SP \\n[Lsp]u
  2031. .misc@ev-keep lix
  2032. .init@reset
  2033. .br
  2034. .ie (\w'\\$1\\$2')>(\\n[.l]-\\n[.i]) \{\
  2035. .    in +\w'\\$1'u
  2036. .    ti 0
  2037. .\}
  2038. .el .ce 1
  2039. \fB\\$1\fP\\$2
  2040. .br
  2041. .ev
  2042. ..
  2043. .\" hide printout until diversion is evaluated
  2044. .de lix@embedded-text
  2045. \!.SP \\n[Lsp]u
  2046. \!.misc@ev-keep lix
  2047. \!.init@reset
  2048. \!.br
  2049. \!.ie (\w'\\$1\\$2')>(\\n[.l]-\\n[.i]) \{\
  2050. \!.    in +\w'\\$1'u
  2051. \!.    ti 0
  2052. \!.\}
  2053. \!.el .ce 1
  2054. \!\fB\\$1\fP\\$2
  2055. \!.br
  2056. \!.ev
  2057. ..
  2058. .\"------------
  2059. .\" print complete list of XXXX
  2060. .de lix@print-ds
  2061. .\" arg: fg,tb,ec,ex text
  2062. .if !\\n[Cp] .pg@next-page
  2063. .\" print LIST OF XXXX
  2064. .ce
  2065. \\$2
  2066. .SP 3
  2067. .in \\n[lix*wth\\$1]u
  2068. .fi
  2069. .lix*ds\\$1
  2070. ..
  2071. .\"------------
  2072. .\" save line of list in macro
  2073. .de lix@ds-save
  2074. .\" type pagenumber text
  2075. .am lix*ds\\$1
  2076. .lix@dsln \\$1 \\$2 "\\$3" "\\$4" \\$5
  2077. \\..
  2078. ..
  2079. .\"------------
  2080. .\" print appended macro
  2081. .\" lix@dsln type pagenumber text headernr
  2082. .de lix@dsln
  2083. .nr lix*i \\n[lix*wth\\$1]-\w'\\$4'
  2084. .ne 2v
  2085. .ll -4m
  2086. .ti 0
  2087. \h'\\n[lix*i]u'\\$4\\$3
  2088. .sp -1
  2089. .ll
  2090. .ti \\n[.l]u-\w'\\$2'u
  2091. \\$2
  2092. ..
  2093. .\"########################### module fnt ############################
  2094. .\" some font macros.
  2095. .de R
  2096. .ft R
  2097. .ul 0
  2098. ..
  2099. .\"-----------
  2100. .de fnt@switch
  2101. .ul 0
  2102. .ds fnt*tmp
  2103. .nr fnt*prev \\n[.f]
  2104. .nr fnt*i 2 1
  2105. .while \\n+[fnt*i]<=\\n[.$] \{\
  2106. .    if \\n[fnt*i]>3 .as fnt*tmp \,
  2107. .    ie (\\n[fnt*i]%2)=1 .as fnt*tmp \\$1\\$[\\n[fnt*i]]
  2108. .    el .as fnt*tmp \\$2\\$[\\n[fnt*i]]
  2109. .    if \\n[fnt*i]<\\n[.$] .as fnt*tmp \/
  2110. .\}
  2111. \\*[fnt*tmp]\f[\\n[fnt*prev]]
  2112. ..
  2113. .\"-----------
  2114. .de B
  2115. .ie \\n[.$] .fnt@switch \fB \f[\\n[.f]] \\$@
  2116. .el .ft B
  2117. ..
  2118. .de I
  2119. .ie \\n[.$] .fnt@switch \fI \f[\\n[.f]] \\$@
  2120. .el .ft I
  2121. ..
  2122. .de IB
  2123. .if \\n[.$] .fnt@switch \fI \fB \\$@
  2124. ..
  2125. .de BI
  2126. .if \\n[.$] .fnt@switch \fB \fI \\$@
  2127. ..
  2128. .de IR
  2129. .if \\n[.$] .fnt@switch \fI \fR \\$@
  2130. ..
  2131. .de RI
  2132. .if \\n[.$] .fnt@switch \fR \fI \\$@
  2133. ..
  2134. .de RB
  2135. .if \\n[.$] .fnt@switch \fR \fB \\$@
  2136. ..
  2137. .de BR
  2138. .if \\n[.$] .fnt@switch \fB \fR \\$@
  2139. ..
  2140. .\"########################### module box ############################
  2141. .\" draw a box around some text. Text will be kept on the same page.
  2142. .\"
  2143. .nr box*ll 0
  2144. .\" .B1 and .B2 works like .DS
  2145. .de B1
  2146. .if \\n[box*ll] .@error "B1: missing B2"
  2147. .nr box*ll \\n[.l]
  2148. .nr box*ind \\n[.i]
  2149. .nr box*hyp \\n[.hy]
  2150. .in +1n
  2151. .ll -1n
  2152. .di box*div
  2153. .hy \\n[.hy]
  2154. ..
  2155. .de B2
  2156. .if !\\n[box*ll] .@error "B2: missing B1"
  2157. .br
  2158. .di
  2159. .nr box*height \\n[dn]
  2160. .ne \\n[dn]u+1v
  2161. .ev box*ev
  2162. .ll \\n[box*ll]u
  2163. .in 0
  2164. .nr box*y-pos \\n[.d]u
  2165. .nf
  2166. .box*div
  2167. .fi
  2168. \v'-1v+.25m'\
  2169. \D'l \\n[.l]u 0'\
  2170. \D'l 0 -\\n[box*height]u'\
  2171. \D'l -\\n[.l]u 0'\
  2172. \D'l 0 \\n[box*height]u'
  2173. .br
  2174. .sp -1
  2175. .ev
  2176. .sp .20v
  2177. .in \\n[box*ind]u
  2178. .ll \\n[box*ll]u
  2179. .rm box*div
  2180. .nr box*ll 0
  2181. ..
  2182. .\"########################### module ref ############################
  2183. .nr ref*nr 0 1
  2184. .nr ref*nr-width 5n
  2185. .ds Rf \v'-.4m'\s-3[\\n+[ref*nr]]\s0\v'.4m'
  2186. .\" start reference
  2187. .de RS
  2188. .if !''\\$1' .ds \\$1 \\n[ref*nr]
  2189. .ev ref*ev
  2190. .da ref*div
  2191. .init@reset
  2192. .ll \\n[@ll]u
  2193. .in \\n[ref*nr-width]u
  2194. .ti -(\w'\\n[ref*nr].'u+1n)
  2195. \\n[ref*nr].
  2196. .sp -1
  2197. ..
  2198. .de RF
  2199. .br
  2200. .if \\n[Ls] .SP 1/\\n[@ntc]u
  2201. .di
  2202. .ev
  2203. ..
  2204. .de RP
  2205. .if !d ref*div .@error "RP: No references!"
  2206. .nr ref*i 0\\$2
  2207. .if \\n[ref*i]<2 .SK
  2208. .SP 2
  2209. .nr ref@toc-lvl 1
  2210. .\" Indent one level if each section has references (N=3)
  2211. .if \\n[pg*ref-reset] .nr ref@toc-lvl 2
  2212. .toc@save \\n[ref@toc-lvl] "" "\\*[Rp]" "\\*[pg*toc-pn-fmt]"
  2213. .ev ref*ev
  2214. .ce
  2215. \fI\\*[Rp]\fP
  2216. .sp
  2217. .in 0
  2218. .nf
  2219. .ref*div
  2220. .in
  2221. .if 0\\$1<1 .nr ref*nr 0 1
  2222. .rm ref*div
  2223. .ev
  2224. .if (\\n[ref*i]=0):(\\n[ref*i]=2) .SK
  2225. ..
  2226. .\"########################### module app ############################
  2227. .\" 
  2228. .nr app*nr 0 1
  2229. .af app*nr A
  2230. .nr app*dnr 0 1
  2231. .\"------------
  2232. .\" .APP name text
  2233. .\" name == "" -> autonumber
  2234. .de APP
  2235. .if \\n[.$]<2 .@error "APP: too few arguments"
  2236. .app@set-ind "\\$1"
  2237. .\"
  2238. .ie \\n[Aph] .app@header \\*[app*ind] "\\$2"
  2239. .el .bp
  2240. .app@index "\\*[app*ind]" "\\$2"
  2241. ..
  2242. .\"------------
  2243. .\" .APPSK name pages text
  2244. .\" name == "" -> autonumber
  2245. .de APPSK
  2246. .if \\n[.$]<2 .@error "APPSK: too few arguments"
  2247. .app@set-ind "\\$1"
  2248. .\"
  2249. .ie \\n[Aph] .app@header \\*[app*ind] "\\$3"
  2250. .el .bp
  2251. .app@index "\\*[app*ind]" "\\$3"
  2252. .pn +\\$2
  2253. ..
  2254. .\"------------
  2255. .de app@set-ind
  2256. .ie \w'\\$1' .ds app*ind \\$1
  2257. .el \{\
  2258. .    if !\\n[app*dnr] \{\
  2259. .        nr H1 0 1
  2260. .        af H1 A
  2261. .    \}
  2262. .    ds app*ind \\n+[app*nr]
  2263. .    nr H1 \\n+[app*dnr]
  2264. .\}
  2265. .\"    clear lower counters
  2266. .nr app*i 1 1
  2267. .while \\n+[app*i]<8 .nr H\\n[app*i] 0 1
  2268. ..
  2269. .\"------------
  2270. .de app@index
  2271. .toc@save 1 "" "\\*[App] \\$1: \\$2" "\\*[pg*toc-pn-fmt]"
  2272. ..
  2273. .\"------------
  2274. .\" app@heaer name text
  2275. .de app@header
  2276. .bp
  2277. .SP \\n[Lsp]u*4u
  2278. .ce 1
  2279. \s+4\fB\\*[App]\ \\$1\fP\s0
  2280. .SP \\n[Lsp]u*2u
  2281. .if \w'\\$2'<\\n[.l] .ce 1
  2282. \fB\s+2\\$2\s0\fP
  2283. .SP \\n[Lsp]u*4u
  2284. ..
  2285. .\"########################### module cov ############################
  2286. .\" title stored in diversion cov*title
  2287. .\" abstract stored in diversion cov*abstract
  2288. .\"    arg to abstract stored in cov*abs-arg
  2289. .\"    indent stored in cov*abs-ind
  2290. .\" number of authors stored in cov*au
  2291. .\" author(s) stored in cov*au!x!y
  2292. .\" author(s) title stored in cov*at!x!y
  2293. .\"     x is the author-index [1-cov*au], y is the argument-index [1-9].
  2294. .\" author(s) firm stored in cov*firm
  2295. .\" new date (if .ND exists) is stored in cov*new-date
  2296. .\"
  2297. .\"
  2298. .nr cov*au 0
  2299. .de TL
  2300. .if \\n[.$]>0 .ds cov*title-charge-case \\$1
  2301. .if \\n[.$]>1 .ds cov*title-file-case \\$2
  2302. .pg@disable-top-trap
  2303. .ev cov*ev
  2304. .init@reset
  2305. .hy 0
  2306. .eo
  2307. .di cov*title
  2308. ..
  2309. .\"-------------------
  2310. .de cov@title-end
  2311. .ec
  2312. .if '\\n[.z]'cov*title' \{\
  2313. .    br
  2314. .    di
  2315. .    asciify cov*title
  2316. .    ev
  2317. .\}
  2318. ..
  2319. .\"-------------------
  2320. .\" .AU name [initials [loc [dept [ext [room [arg [arg [arg]]]]]]]]
  2321. .de AU
  2322. .cov@title-end
  2323. .pg@disable-top-trap
  2324. .if \\n[.$]<1 .@error "AU: no arguments"
  2325. .nr cov*au +1
  2326. .nr cov*i 0 1
  2327. .while \\n[.$]>=\\n+[cov*i] \{\
  2328. .    ds cov*au!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2329. .\}
  2330. .if (\\n[.$]>=3)&(\w'\\$3') \{\
  2331. .    if d cov*location-\\$3] \{\
  2332. .        ds cov*au!3!\\n[cov*au] \\*[cov*location-\\$3]
  2333. .    \}
  2334. .\}
  2335. ..
  2336. .\"-------------------
  2337. .\" .AT title1 [title2 [... [title9] ]]]]
  2338. .\" Well, thats all that COVEND look for.
  2339. .\" Must appear directly after .AU
  2340. .de AT
  2341. .if \\n[.$]<1 .@error "AT: no arguments"
  2342. .nr cov*i 0 1
  2343. .while \\n[.$]>=\\n+[cov*i] \{\
  2344. .    ds cov*at!\\n[cov*au]!\\n[cov*i] "\\$[\\n[cov*i]]
  2345. .\}
  2346. ..
  2347. .\"-------------------
  2348. .de AF
  2349. .cov@title-end
  2350. .if \\n[.$]<1 .@error "AF: no arguments"
  2351. .ds cov*firm \\$1
  2352. ..
  2353. .de AS
  2354. .pg@disable-top-trap
  2355. .if d cov*abstract .@error "AS: only one abstract allowed"
  2356. .if !''\\n[.z]' .@error "AS: no diversion allowed (previous .AS?)"
  2357. .nr cov*abs-arg 0\\$1
  2358. .nr cov*abs-ind (n;0\\$2)
  2359. .misc@ev-keep cov*ev
  2360. .init@reset
  2361. .nf
  2362. .de cov*abstract AE
  2363. ..
  2364. .de AE
  2365. .ev
  2366. ..
  2367. .\" I am planning to use mgm some time :-)
  2368. .ie \\n[yr]<50 .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 20\\n[yr]
  2369. .el .ds cov*new-date \\*[MO\\n[mo]] \\n[dy], 19\\n[yr]
  2370. .als DT cov*new-date
  2371. .de ND
  2372. .\" don't remember why I did this: .pg@disable-top-trap
  2373. .ds cov*new-date \\$1
  2374. ..
  2375. .\"-------------------
  2376. .\" save technical numbers.
  2377. .de TM
  2378. .nr cov*i 0 1
  2379. .while \\n[.$]>=\\n+[cov*i] .ds cov*mt-tm!\\n[cov*i] \\$[\\n[cov*i]]
  2380. .nr cov*mt-tm-max \\n[.$]
  2381. ..
  2382. .\"-----------------------
  2383. .\" cover sheet
  2384. .\" the file must have the following last lines (somewhere):
  2385. .\" .pg@enable-top-trap
  2386. .\" .bp 1
  2387. .\" .pg@enable-trap
  2388. .ds cov*mt-file!0 0.MT
  2389. .ds cov*mt-file!1 0.MT
  2390. .ds cov*mt-file!2 0.MT
  2391. .ds cov*mt-file!3 0.MT
  2392. .ds cov*mt-file!4 4.MT
  2393. .ds cov*mt-file!5 5.MT
  2394. .ds cov*mt-file!6 0.MT
  2395. .\"------------
  2396. .de MT
  2397. .ie \\n[.$] \{\
  2398. .    ie d cov*mt-file!\\$1 .ds cov*mt-type \\$1
  2399. .    el .ds cov*mt-type 6
  2400. .\}
  2401. .el .ds cov*mt-type 1
  2402. .ds cov*mt-addresse "\\$2
  2403. .ds cov*mt-type-text "\\$1
  2404. .ie d @language .ds cov*str mm/\\*[@language]_
  2405. .el .ds cov*str mm/
  2406. .mso \\*[cov*str]\\*[cov*mt-file!\\*[cov*mt-type]]
  2407. ..
  2408. .de COVER
  2409. .ie !\\n[.$] .ds cov*cov-type ms
  2410. .el .ds cov*cov-type \\$1
  2411. .pg@disable-top-trap
  2412. .ie d @language .ds cov*str mm/\\*[@language]_\\*[cov*cov-type].cov
  2413. .el .ds cov*str mm/\\*[cov*cov-type].cov
  2414. .mso \\*[cov*str]
  2415. ..
  2416. .\"########################### module qrf ############################
  2417. .\" forward and backward reference thru special files.
  2418. .\"
  2419. .\" init reference system
  2420. .de INITR
  2421. .if \\n[.$]<1 .@error "INITR:filename missing"
  2422. .\" ignore if INITR has already been used
  2423. .if !r qrf*pass \{\
  2424. .\"
  2425. .    ds qrf*file \\$1
  2426. .    sy test -f \\*[qrf*file].tmp
  2427. .    ie \\n[systat] \{\
  2428. .        \" PASS 1
  2429. .        if \\n[D]=1 .tm PASS 1
  2430. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 1
  2431. .        nr qrf*pass 1
  2432. .        open qrf*stream \\*[qrf*file].tmp
  2433. .        write qrf*stream .\\\\" references for \\*[qrf*file]
  2434. .        close qrf*stream
  2435. .    \}
  2436. .    el \{\
  2437. .        nr qrf*pass 2
  2438. .        if \\n[D]=1 .tm PASS 2
  2439. .        if \\n[D]>1 .tm INITR: file \\*[qrf*file].tmp, PASS 2
  2440. .        sy mv  \\*[qrf*file].tmp  \\*[qrf*file].qrf
  2441. '        so  \\*[qrf*file].qrf
  2442. .    \}
  2443. .\}
  2444. ..
  2445. .\"---------------
  2446. .\" set a reference.
  2447. .de SETR
  2448. .if \\n[.$]<1 .@error "SETR:reference name missing"
  2449. .ie !r qrf*pass .tm "SETR: No .INITR in this file"
  2450. .el \{\
  2451. .    ds qrf*name qrf*ref-\\$1
  2452. .\" probably pass two if already defined
  2453. .    if \\n[qrf*pass]<2 \{\
  2454. .        if \\n[D]>2 .tm SETR: ref \\*[qrf*name]=\\*[hd*toc-mark],\\n[%]
  2455. .        \" heading-number
  2456. .        ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2457. .        \" page-number
  2458. .        ds \\*[qrf*name]-pn \\n[%]
  2459. .        \"
  2460. .        \" append to file
  2461. .        opena qrf*stream \\*[qrf*file].tmp
  2462. .        write qrf*stream .ds \\*[qrf*name]-hn \\*[hd*toc-mark]
  2463. .        write qrf*stream .ds \\*[qrf*name]-pn \\n[%]
  2464. .        if !'\\$2'' .write qrf*stream .ds \\*[qrf*name]-xx \\$2
  2465. .        close qrf*stream
  2466. .    \}
  2467. .\}
  2468. ..
  2469. .\"---------------
  2470. .\" get misc-string, output <->42<-> in pass 1
  2471. .\" If two arg -> set var. arg to misc-string.
  2472. .de GETST
  2473. .if \\n[.$]<1 .@error "GETST:reference name missing"
  2474. .if !r qrf*pass .tm "GETST: No .INITR in this file"
  2475. .ds qrf*name qrf*ref-\\$1
  2476. .ie \\n[qrf*pass]=2 \{\
  2477. .    ie !d \\*[qrf*name]-xx .tm "GETHN:\\$1 not defined"
  2478. .    el \{\
  2479. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-xx]
  2480. .        el \\*[\\*[qrf*name]-xx]\c
  2481. .    \}
  2482. .\}
  2483. .\" The answer...
  2484. .el <->42<->\c
  2485. ..
  2486. .\"---------------
  2487. .\" get header-number, output X.X.X. in pass 1
  2488. .\" If two arg -> set var. arg to header-number.
  2489. .de GETHN
  2490. .if \\n[.$]<1 .@error "GETHN:reference name missing"
  2491. .if !r qrf*pass .tm "GETHN: No .INITR in this file"
  2492. .ds qrf*name qrf*ref-\\$1
  2493. .ie \\n[qrf*pass]=2 \{\
  2494. .    ie !d \\*[qrf*name]-hn .tm "GETHN:\\$1 not defined"
  2495. .    el \{\
  2496. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-hn]
  2497. .        el \\*[\\*[qrf*name]-hn]\c
  2498. .    \}
  2499. .\}
  2500. .el X.X.X.\c
  2501. ..
  2502. .\"---------------
  2503. .\" get page-number, output 9999 in pass 1
  2504. .\" If two arg -> set var. arg to page-number.
  2505. .de GETPN
  2506. .if \\n[.$]<1 .@error "GETPN:reference name missing"
  2507. .if !r qrf*pass .tm "GETPN: No .INITR in this file"
  2508. .ds qrf*name qrf*ref-\\$1
  2509. .ie \\n[qrf*pass]=2 \{\
  2510. .    ie !d \\*[qrf*name]-pn .tm "GETPN:\\$1 not defined"
  2511. .    el \{\
  2512. .        ie \\n[.$]>1 .ds \\$2 \\*[\\*[qrf*name]-pn]
  2513. .        el \\*[\\*[qrf*name]-pn]\c
  2514. .    \}
  2515. .\}
  2516. .el 9999\c
  2517. ..
  2518. .\"----------
  2519. .de GETR
  2520. .if \\n[.$]<1 .@error "GETR:reference name missing"
  2521. .ie !r qrf*pass \{\
  2522. .    tm "GETR: No .INITR in this file"
  2523. .\}
  2524. .el \{\
  2525. .    if \\n[qrf*pass]=2 \{\
  2526. .        GETHN \\$1 Qrfh
  2527. .        GETPN \\$1 Qrfp
  2528. \\*[Qrf]
  2529. .    \}
  2530. .\}
  2531. ..
  2532.